The Idea of Encapsulation
As you learned in the preceding section, C++ does not penalize you for separating data from the interface. If an object is going to manage its own data, then this separation is important. In the object-oriented view of things, accessing a class's data directly is bad manners, because it makes it hard for the class to take full responsibility for the data. This principle, that data should be private, is called encapsulation. In the next few sections, I want to show you why this is a good principle to follow.
Protecting the Representation
It is possible to manage complex organizations only if the various tasks are delegated properly. People are given tasks and responsibility for finishing them; they should not bother their ...
Get C++ By Example: UnderC Learning Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.