Inheritance
Inheritance is a process in which one object acquires all the properties and behaviors of its parent object automatically. In such a way, you can reuse, extend or modify the attributes and behaviors which are defined in other classes.
In C++, the class which inherits the members of another class is called derived class and the class whose members are inherited is called base class. The derived class is the specialized class for the base class.
Types of inheritance:-
1) Single inheritance:-
When one class inherits another class, it is known as single inheritance.
2) Multiple inheritance:-
It is the process of deriving a new class that inherits the attributes from two or more classes.
3)Hierarchical inheritance:-
It is define as the process of deriving more than one class from a base class.
4) Multilevel inheritance:-
It is process of deriving a class from another derived class.
5) Hybrid inheritance:-
It is combination of simple, multiple inheritance and hierarchical inheritance.
Comments
Post a Comment