Understanding Different Types of Inheritance in Java - Hierarchical Inheritance
Welcome again!
Today's topic is Hierarchical Inheritance:
Boss icons created by Freepik - Flaticon
Hierarchical inheritance occurs when a single superclass has multiple subclasses. This allows you to create a class hierarchy, where a subclass can inherit properties and behaviors from its parent class, which can in turn inherit from another parent class.
When is this type of inheritance useful?
Hierarchical inheritance is useful when you want to create a class hierarchy that represents a specific domain, such as a set of shapes or a set of vehicles.
Wait for my next post on the last type of inheritance: Hybrid Inheritance
Comments
Post a Comment