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 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.