Hour 17. Using Polymorphism and Derived Classes
Polymorphism Implemented with Virtual Methods
The previous hour emphasized the fact that a
Dog object is a
Mammal object. This meant that the
Dog object inherited the attributes (data) and capabilities (member functions) of its base class. The relationship between a base class and derived class runs deeper than that in C++.
Polymorphism allows derived objects to be treated as if they were base objects. For example, suppose you create specialized
Mammal types ...