Home Segments Index Top Previous Next

Chapter 9:

How To Create Classes and Objects

To describe a box car, viewed as a container, you think naturally in terms of its height, width, and length. To describe a tank car, viewed as a container, you think naturally in terms of its radius and length.

Thus, the numbers that describe a particular box car or tank car constitute a natural bundle—a bundle of three numbers for each individual that belongs to the box-car category, and a bundle of two numbers for each individual that belongs to the tank-car category.

In this chapter, you learn that C++'s great virtue is that C++ offers programming-language mechanisms that enable you to describe, construct, and manipulate bundles of descriptive data items that mirror real-world individuals and categories. These special mechanisms set C++ apart from most other programming languages, including C, C++'s parent language.