What is inheritance?
The mechanism by which a new class in derived from existing classes is called inheritance. Here existing classes are known as discussed and the new classes are known as derived classes.
By following figure we can demonstrate the basic concept of inheritance--------
Fig: basic concept of inheritance
Characteristic of inheritance:
In C++ inheritance machanism is may be categorise by--------
1. Single inheritance
2. Multiple inheritance
3. Multilevel inheritance
4. Hierarchical inheritance
5. Hybrid inheritance
6. Multipath inheritance
1. Single inheritance:
The inheritance mechanism in which a new class we derived from only one base class is called single inheritance.
2. Multiple inheritance:
the inheritance mechanism in which a new classes is derived from two or more base classes then it is termed as multiple inheritance.
3. Multilevel inheritance:
The inheritance mechanism in which a new class is derived from another derived class called multilevel inheritance.
4. Hierarchical inheritance:
The inheritance mechanism in which two or more new class are derived from only one base class then it is term as hierarchical inheritance.
5. Hybrid inheritance:
The inheritance mechanism in which two or more inheritance concept are applied then it is termed as hybrid inheritance.
6. Multipath inheritance:
When the child has two direct base classes which themself have a common base class then the child inheritance the treated of grandparent vai to separate path. This type of inheritance is referred to as multipath inheritance their child class would have duplicate set of the member inheritance from grandparents thought parent classes.
Characteristic of inheritance:
In C++ inheritance machanism is may be categorise by--------
1. Single inheritance
2. Multiple inheritance
3. Multilevel inheritance
4. Hierarchical inheritance
5. Hybrid inheritance
6. Multipath inheritance
1. Single inheritance:
The inheritance mechanism in which a new class we derived from only one base class is called single inheritance.
2. Multiple inheritance:
the inheritance mechanism in which a new classes is derived from two or more base classes then it is termed as multiple inheritance.
3. Multilevel inheritance:
The inheritance mechanism in which a new class is derived from another derived class called multilevel inheritance.
4. Hierarchical inheritance:
The inheritance mechanism in which two or more new class are derived from only one base class then it is term as hierarchical inheritance.
5. Hybrid inheritance:
The inheritance mechanism in which two or more inheritance concept are applied then it is termed as hybrid inheritance.
6. Multipath inheritance:
When the child has two direct base classes which themself have a common base class then the child inheritance the treated of grandparent vai to separate path. This type of inheritance is referred to as multipath inheritance their child class would have duplicate set of the member inheritance from grandparents thought parent classes.
0 Comments
Post a Comment