Encapsulation (computer science)
Appearance
Encapsulation is the grouping together of data and functionality. While the C language used structs to group data together, C++ adds the functionality component. This does the following:
- Allows a programmer to explicitly provide the interface to an object
- Allows hiding of implementation details
- Allows programmer to think in an object-oriented way
Encapsulation simplifies programming by modeling the world: the world consists of objects that do things. Thus programs become a collection of objects and how they act, instead of a set of instructions.
Encapsulation: It is the mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data. A well-defined interface controls the access to that particular code and data