NIOS Computer Science: Chapter 14 – Inheritance Extending Classes Part 2

Download PDF of This Page (Size: 668K)

Image shows type of Inheritance

Image Shows Type of Inheritance

Image shows type of Inheritance

Different Forms of Inheritance

The mechanism of deriving a new class from an old one is called inheritance (or derivation).

The old class is referred to as the base class and new one is called the derived class.

There are various forms of inheritance.

Image of Different Forms of Inheritance

Image of Different Forms of Inheritance

Image of Different Forms of Inheritance

(i) Single inheritance A derived class with only one base class is called single inheritance.

Image of Single inheritance

Image of Single Inheritance

Image of Single inheritance

(ii) Multiple inheritance A derived class with several base classes is called multiple inheritance.

Image of Multiple inheritance

Image of Multiple Inheritance

Image of Multiple inheritance

(iii) Multilevel inheritance The mechanism of deriving a class from another derived class is called multilevel inheritance.

Image of Multilevel inheritance

Image of Multilevel Inheritance

Image of Multilevel inheritance

(iv) Hierarchical inheritance One class may be inherited by more than one classes. This process is known as hierarchical inheritance.

Image of Hierarchical inheritance

Image of Hierarchical Inheritance

Image of Hierarchical inheritance

(v) Hybrid inheritance It is a combination of hierarchical and multiple inheritance.

Image of Hybrid inheritance

Image of Hybrid Inheritance

Image of Hybrid inheritance