Besides making it easy for you to define new data types, C++ also lets you express relationships between those types. This is done with two of C++'s features: the first is “inheritance,” which lets you define one type to be a subcategory of another. The second is “polymorphism,” which lets you use related types together.
This chapter describes the mechanics of inheritance and polymorphism. In Part 3, “Object-Oriented Design,” you'll see how these features play a role when you design a program.
This chapter covers the following topics:
Base and derived classes
Redefining members of a base class
Conversions between base and derived classes
Virtual functions and late binding
Abstract classes
The protected keyword
Before describing in detail C++'s features for handling related types, let's consider how you might do so in C.