Objectives of This Chapter

By the end of this chapter, you should

  1. understand how we can use inheritance to create a new class by extending an existing class, and

  2. understand how to use manipulators to control the format of iostream output.

Two Reasons to Use Inheritance

Before we return to the detailed examination of our inventory control classes (StockItem and its companion class Inventory) let's expand a bit on the first objective as it applies to this case.

There are two reasons to use inheritance. The first is to create a new class that has all of the capabilities of an existing class while adding capabilities that are unique to the new class. In such a case, objects of the new class are clearly not equivalent to objects of the existing class ...

Get C++: A Dialog Programming with the C++ Standard Library now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.