Types of Inheritance
1. Single Inheritance:
In single inheritance, a class can inherit from only one parent class. This is the simplest form of inheritance. The derived class inherits the attributes and methods of a single base class.
2. Multiple Inheritance:
Multiple inheritance allows a class to inherit from more than one parent class. In this case, the derived class inherits the attributes and methods of multiple base classes.
3. Multilevel Inheritance:
In multilevel inheritance, a class derives from another class, which in turn derives from another class, creating a chain or hierarchy of classes.
4. Hierarchical Inheritance:
In hierarchical inheritance, multiple derived classes inherit from a single base class. This creates a tree-like structure of classes, with a common base class.
5. Hybrid Inheritance:
Hybrid inheritance is a combination of two or more types of inheritance within the same program.
Post #1139
616
