previous |
start |
next
Calling Base-Class Member Functions
- Suppose B::f is
a function in the base class. The the derived class
D can take three kinds of actions.
- The derived class can extend
B::f by supplying a new
implementation that refers to the base-class implementation. For
example, the TravelClock::get_hours function is an
extension of Clock::get_hours.
- The derived class can replace
B::f by supplying a new
implementation that is unrelated to the base-class implementation.
For example, TravelClock::get_location is a replacement
for Clock::get_location.
- The derived class can inherit
B::f by not supplying an
implementation for f. For example,
TravelClock inherits Clock::get_minutes and
Clock::is_military.
previous |
start |
next