O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Encapsulation and Messages

Also known as data-hiding, encapsulation is an important part of successful object-oriented design, both from the standpoint of creating the design itself and as an aid to design reuse. In other words, the more encapsulated the data is, the easier it will be to reuse parts of the design and, by extension, the implementation. The principle of encapsulation is to keep all the data that pertains to the state of an object internal and not accessible by other objects. This means that if an object needs to know something about another object, you must give it the means to obtain that information without having access to the data.

In order to interact with the object, you need only know the interface requirements—what data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required