Container Classes

The previous section discussed a number of special cases for composite class data members that you are not likely to use every day. This section discusses a number of special cases for composite class data members that you are going to use very often. Even if you will not be writing similar classes yourself, you are going to use container classes written by others. Container classes are a special case of composite classes, which are useful when the application needs a data type that contains a dynamic collection of values. Almost any application needs one (or more).

Even the first examples of class composition that I discussed in this chapter (e.g., class Rectangle) contained a collection of components, in this case, objects ...

Get Core C++ A Software Engineering Approach 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.