Inheritance (or Derivation)








It is always nice if we could reuse something that already exists, rather than trying to create the same all over again . It would not only save time and money but also increase reliability .
The mechanism of deriving a new class from an old one is called inheritance or derivation .

The new class known as sub class / child class / derived class.
The existing class known as super class / parent class / base class.

Some other common definitions are :
1. An object can acquire the properties of another object.
Top

Different Forms of Inheritance

(1) Single Inheritance .

(2) Multiple Inheritance .

(3) Hierarchical Inheritance .

(4) Multilevel Inheritance .

(5) Hybrid Inheritance .

Single Inheritance

A derived class with only one base class , is known as single inheritance .

Multiple Inheritance

A derived class with several base classes is known as multiple inheritance .

Hierarchical Inheritance

Several derived classes with only one base class is known as Hierarchical inheritance .

Multilevel Inheritance

A derived class with already derived one, means the mechanism of deriving a class from another class is known as multilevel inheritance .

Hybrid Inheritance

When two or more than two types of inheritance are needed to be combined together, then hybrid inheritance is used .
Top
Clicky Web Analytics