Inheritance in Oops ?

Inheritance

Inheritance is the reusability of code. In other words, The properties or features of the object of that class is acquire to another object of another class is known as inheritance.

  • Types -: 
    1. Single level Inheritance
    2. Multiple Inheritance
    3. Multilevel Inheritance
    4. Hierarchical Inheritance
    5. Hybrid Inheritance
1. Single level Inheritance -: When one class inherits only one class.
            
Single level Inheritance

2. Multiple Inheritance -: When one class inherits from more than one class.
Multiple Inheritance

3. Multilevel Inheritance -: When one class inherits from an already derived class.
Multilevel Inheritance

4. Hierarchical Inheritance -: When many classes inherit from the same class.
Hierarchical Inheritance

5. Hybrid Inheritance -: Combination of two or more types of Inheritance.

No comments