What is Inheritance?Inheritance is concept of obtaining the properties of object from one class to object of another class. It’s been mainly used for its Reusability.
Types of InheritanceThere are six types of Inheritance1. Single Inheritance2. Multiple Inheritance3. Multilevel Inheritance4. Hierarchical Inheritance5. Hybrid Inheritance6. Multipart Inheritance
Single Inheritance A Base Class B Derived Class •It contains one Base Class and one Derived Class.•Contents of the Base Class is Inherited into the Derived Class.
Multiple InheritanceBase Class A B Base Class C Derived Class •Two or More Base Class is Inherited into a Single Derived Class.
Hierarchical Inheritance A Base ClassDerived Class 1 B C Derived Class 2 •Hierarchical Inheritance is straight opposite to Multiple Inheritance. •One Base Class is Inherited into two or more Derived Class.
Multi Level Inheritance A Base Class B Derived Class C Base Class C1 Base Class Derived Class •One of the different form of Inheritance. •Here, Base Class is Inherited by anotherDerived Class and Derived Class changes intoBase Class and then Inherited into a Derived Class.
Hybrid Inheritance A Base Class Derived Class D1 B Derived ClassBase Class C C1 Derived Class D Base Class •One of the complex type of Inheritance. •Here Base Class is Inherited to Derived Class and the Derived Class changes to Base Class and once again Inherited to Derived Class. •It is a combination of Single Inheritance and Multi Level Inheritance.
Multipart Inheritance Base Class A C DDerived DerivedClass Class Y Derived Class •The Diagram itself explains that it is possible to have a single Base Class and that Base Class is Inherited into a collection of Derived Class in any Part
Representation of Symbol Base Class Derived Class Base Class Inherited to Derived Class Derived Class Inherited to Base Class
Slides Created by SrinathThanks for watching the Slide