Encapsulation

Encapsulation is in OOP concept the act of collecting or packing the raw data and the functions that operate on it into a single unit or block so that programming, debugging and understanding of the program becomes easy. Encapsulation is one of the most important features of OOP which makes it different from others.

The encapsulated data can only be read using the encapsulated functions and not in any other way this prevents data damage or loss as well as implements data abstraction by exposing only the relevant data and keeping other things invisible.

For example in C++ programming structures and classes are encapsulated entity but we will learn about them later .In the real world we keep all the books in our bag after using them but for books from others bags we first ask for the book and then take it there is no other way of taking books or to be more specific data from others.

Make a Free Website with Yola.