Inheritance

6,258 views
6,195 views

Published on

Published in: Technology, Sports
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
6,258
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
371
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Inheritance

  1. 1. C++ Inheritance BY- Ashish Awasthi
  2. 2. Introduction ► The capability of one class to inherit properties from another class is called INHERITANCE. This is the property of OBJECT ORIENTED PROGRAMMING, which derives new classes (called derived classes) from old ones. With the derived class inheriting the properties, including the method of the old class is known as base class.
  3. 3. Concept of INHERITANCE Property A Base class Property B Property C Derived From Defined in Property D Derived Class Property A Defined in Base Class Property B But accessible from Derived class Derived Class Property C
  4. 4. Levels of INHERITANCE ► (A)- Single Inheritance. ► (B)- Multilevel Inheritance. ► (C)- Multiple Inheritance. ► (D)- Hierarchical Inheritance. ► (E)- Hybrid Inheritance.
  5. 5. Single Inheritance • In this INHERITANCE have only one Base class and one Derived class. BASE CLASS DERIVED CLASS
  6. 6. Multilevel Inheritance • In this INHERITANCE we have a chain of all classes and one BASE LINE , In this we must have to use three classes, there is one Base class and more than one Derived classes. Class A BASE CLASS Class B DERIVED CLASSES Class C
  7. 7. Multiple Inheritance •In this INHERITANCE we have more than one independent Base classes and one Derived class, connected with all Base classes. Class A Class B BASE CLASSES Class C DERIVED CLASS
  8. 8. Hierarchical Inheritance •This INHERITANCE is just opposite of Multiple inheritance. Class A BASE CLASS Class B Class C DERIVED CLASES
  9. 9. Hybrid Inheritance •This is a combine form of Multiple and Hierarchical Inheritance. Class A BASE CLASS Class B Derived Base class Class C Class D DERIVED CLASS

×