Types of inheritance
Based on the number of super class and subclass we can classify inheritance into several types. They are
(1) Simple / Single Inheritance

(1) Simple / Single Inheritance
Here only one subclass is derived from a single super class.
(2) Multilevel InheritanceWhen a subclass is derived from a derived class then this mechanism is known as the multilevel inheritance. The derived class is called the subclass or child class for it's parent class and this parent class works as the child class for it's just above ( parent ) class. Multilevel inheritance can go up to any number of level.
3) Hierarchical inheritance
In this type of inheritance we can derive more than one sub class from a single super class.
4) Multiple Inheritance
When a subclass is derived from more than one super class then it is called multiple inheritance. Multiple inheritance is not supported by Java. Multiple inheritance can be implemented with the help of interface in Java.
5) Hybrid inheritance
This is a combination of multilevel and hierarchical inheritance.
The following figure represents the types of inheritance
0 comments
Post a Comment