|
| C++ Program Design, 3/e James P. Cohoon,
University of Virginia Jack W. Davidson,
University of Virginia
Inheritance
Chapter 13 OverviewA key feature of an object-oriented language is inheritance. Inheritance is the
ability to define new classes using existing classes as a basis. The new class
inherits the attributes and behaviors of the classes on which it is based, and it
can also have attributes and behaviors that are specific to it. Inheritance is a
powerful mechanism that provides a natural framework for producing software
that is reliable, understandable, cost-effective, adaptable, and reusable. In this
chapter, we introduce C++’s inheritance mechanism by developing a class
hierarchy for representing and displaying two-dimensional shapes. The
resulting classes are used to refine and expand the kaleidoscope program
developed in Chapter 7. |
|
|