Thursday, 30 January 2014

Inheritance In programing Langauge

Inheritance


"  Inheritance is the Process of creating a new class  from existing class.The old class is referred to as the base class and the new classes, which are inherited from the base class, are called derived classes "

Types of Inheritance

There are five different inheritances supported in C++:
  • (1)  Single
  • (2) Multilevel
  • (3) Hierarchical
  • (4) Multiple
  • (5) Hybrid
  • (6)Multi path




Single Inheritance - If a class is derived from a single base class, it is called as single inheritance.


Multiple Inheritance - If a class is derived from more than one base class, it is known as multiple inheritance.




Multilevel Inheritance - The classes can also be derived from the classes that are already derived. This type of inheritance is called multilevel inheritance.



Hierarchical Inheritance - If a number of classes are derived from a single base class, it is called as hierarchical inheritance.


Example Of Inheritance :





0 comments:

Post a Comment