This document discusses inheritance in object-oriented programming. It defines inheritance as obtaining properties from one class to another. It then describes six types of inheritance: single, multiple, multilevel, hierarchical, hybrid, and multipart. Each type is explained with an example diagram illustrating the inheritance relationships between base and derived classes.
2. 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.
3. Types of Inheritance
There are six types of Inheritance
1. Single Inheritance
2. Multiple Inheritance
3. Multilevel Inheritance
4. Hierarchical Inheritance
5. Hybrid Inheritance
6. Multipart Inheritance
4. 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.
5. Multiple Inheritance
Base Class A B Base Class
C
Derived Class
•Two or More Base Class is Inherited
into a Single Derived Class.
6. Hierarchical Inheritance
A Base Class
Derived 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.
7. 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 another
Derived Class and Derived Class changes into
Base Class and then Inherited into a Derived
Class.
8. Hybrid Inheritance
A Base Class Derived Class
D1
B Derived Class
Base 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.
9. Multipart Inheritance
Base Class
A
C D
Derived Derived
Class 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
10. Representation of Symbol
Base Class
Derived Class
Base Class Inherited to Derived
Class
Derived Class Inherited to Base
Class