Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Chapter 4.  Data Encapsulation and Value Types


4.1. A Taxonomy of Data Encapsulation

We saw in the last chapter that there were various levels of resource encapsulation from open structures with API functions to manipulate them through to fully encapsulated classes.

The breakdown of data encapsulation is reflected in C++'s access specifiers. Unencap sulated data, which is defined in a public section of a class (or the default section of a struct or union), is accessible to any other context. (Fully) encapsulated data is defined in a private or protected section of a class type.

With a small set of sample types, it can seem that the level of encapsulation and the degree to which the value type concept is represented are closely related. However, this is not always the case, and there is not necessarily any direct correlation between the two. Naturally, this is just one more permutation to confuse us all, and we should remain mindful of the distinction.


      Previous section   Next section