Hierarchical multilevel inheritance

Hierarchical multilevel inheritance is where a parent class is derived from more than one class and one of the child classes is derived from another class. Take a look at the following diagram, where A is a parent class of D, and D is a parent class of E:

A classic example of this type of inheritance is the Shape class. Different shapes make up our everyday surroundings. All shapes are unique because of their structures. Some shapes, such as a circle and a cylinder, are quite similar, but other shapes, such as a square, an oval, and a triangle, are shapes that are completely different from each other. In ...

Get Hands-On Object-Oriented Programming with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.