Types of Inheritance


 In general there are five types of inheritances:
1.   Simple Inheritance
2.   Multilevel Inheritance
3.   Hierarchical Inheritance
4.   Multiple Inheritance (Not allowed in java)
5.   Hybrid Inheritance (Not allowed in java)



Now we explain one by one:
Simple Inheritance:
In simple inheritance there is only one subclass and one super class.
                                               
                                                       

Multilevel Inheritance
In this one super class can have only one direct sub class and many indirect sub classes.
One subclass can have only one direct super class and many indirect super classes.
 Hierarchical Inheritance
In this inheritance one super class can have many direct subclass.
Multiple Inheritance
In this heritance one subclass can have many direct super classes.
NOTE: Multiple inheritance is not allowed in java through Java class.
Hybrid Inheritance
Hybrid inheritance is the combination of other inheritance type.
NOTE: It is also not allowed in java.

















0 comments :

Post a Comment