Encapsulation
Encapsulation means that all of the members of a class and the processes to be performed on those members must be contained within the class they reside in. Another way of saying this is that the class must contain everything it needs to store and operate in the data it defines. That means, for example, if a class contains date data, it must also contain the information and procedures required to format and print the data, if that is a required function of the class. In pure form, it also means that the class should not have to rely on any external data or procedures, but be entirely self-contained. In this sense, the class can be seen as a complete program unto itself.
Besides containing data and the procedures to be performed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access