Implementation inheritance – changing the purpose of inheritance
So far we demonstrated using a public base class, known also as public inheritance. Public base classes are used to model Is-A relationships and provide the primary motivation behind building an inheritance hierarchy. This usage supports the concepts of generalization and specialization.
Occasionally, inheritance may be used as a tool to implement one class in terms of another, that is, by one class using another as its underlying implementation. This is known as implementation inheritance and it does not support the ideals of generalization and specialization. Yet, implementation inheritance can provide a quick and easily reusable way to implement one class based upon another. It is fast and relatively error-free. Many class libraries use this tool without the knowledge of their class users. It is important to distinguish implementation inheritance from traditional hierarchy building for the motivation of specifying...