11. Object-Oriented Programming: Inheritance

Say not you know another entirely, till you have divided an inheritance with him.

—Johann Kasper Lavater

This method is to define as the number of a class the class of all classes similar to the given class.

—Bertrand Russell

Save base authority from others’ books.

—William Shakespeare

Objectives

In this chapter you’ll learn:

• What inheritance is and how it promotes software reuse.

• The notions of base classes and derived classes and the relationships between them.

• The protected member access specifier.

• The use of constructors and destructors in inheritance hierarchies.

• The order in which constructors and destructors are called in inheritance hierarchies.

• The differences between public

Get C++ How to Program, Ninth Edition 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.