...

/

Inheritance Hierarchy

Inheritance Hierarchy

Learn about inheritance hierarchy in this lesson.

Inheritance: An "is a” relationship

We have seen that implementation inheritance is about acquiring members. Consider this kind of inheritance only if the subtype can be thought of as a kind of the supertype, like in the phrase “alarm clock is a clock.”

“Is a” is not the only relationship between types; a more common relationship is the “has a” relationship. For example, let’s assume that we want to add the concept of a Battery to the Clock class. It would not be appropriate to add ...