11.1 Introduction

This chapter continues our discussion of object-oriented programming (OOP) by introducing inheritance in which you create a class that absorbs an existing class’s capabilities, then customizes or enhances them. Inheritance can save time during program development by taking advantage of proven, high-quality software.

When creating a class, instead of writing completely new data members and member functions, you can specify that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is called the derived class. Other programming languages, such as Java and C#, refer to the base class as the super-class and the derived class as the subclass. A derived class ...

Get C++ How to Program, 10/e 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.