Encapsulation

Encapsulation

Wikipedia link (https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)

A language mechanism for restricting direct access to some of the object's components.[3][4] A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data.[5][6] Some programming language researchers and academics use the first meaning alone or in combination with the second as a distinguishing feature of object-oriented programming, while some programming languages that provide lexical closures view encapsulation as a feature of the language orthogonal to object orientation.

The second definition is motivated by the fact that in many of the OOP languages hiding of components is not automatic or can be overridden; thus, information hiding is defined as a separate notion by those who prefer the second definition.

Last updated