Hierarchical inheritance in Python
Hierarchical inheritance is when we are deriving more than one class from a parent class. Simply speaking, there is going to be one parent class, and more than one derived class. Let’s have a look at an example, through which, we can simply understand the hierarchical inheritance –
Hierarchical inheritance in Python
As you can see in the above program, we have a Parent class, and there are two classes, which are derived from the parent class. This is the Hierarchical Inheritance, and you can use it as and when required. You can also refer to this diagram, which demonstrates hierarchical inheritance.
So, this was much about hierarchical inheritance. We can make use of this type of inheritance in our programs, as and when required. Remember that in the hierarchical inheritance, we are deriving more than one class, from a parent class.
Let’s now consider another type of inheritance, which is hybrid inheritance.