Unit 2
Public Inheritance
Protected Inheritance
Private Inheritance
Advantages of Inheritance
Constructor and Destructor in Derived Class
Types of Inheritance
Single Inheritance
Multilevel Inheritance
Multiple Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Abstract Class
Friend Class
Nested Class
Public Inheritance
All public members of the base class become public members of the derived class.
All Protected members of the base class become protected members of the derived
class.
All private members are inaccessible
Protected Inheritance
All public members of the base class become protected members of the derived class.
All Protected members of the base class become protected members of the derived
class.
All private members are inaccessible.
Unit 2 1
, Private Inheritance
All public members of the base class become private members of the derived class.
All Protected members of the base class become private members of the derived class.
All private members are inaccessible
Advantages of Inheritance
1. Reusability
2. Extensibility
3. Data hiding
4. Overriding
Constructor and Destructor in Derived Class
Base_Constructor → Derived_Constructor → Derived_Destructor → Base_Destructor
Types of Inheritance
Single Inheritance
Multilevel Inheritance
Unit 2 2
Unit 2
Public Inheritance
Protected Inheritance
Private Inheritance
Advantages of Inheritance
Constructor and Destructor in Derived Class
Types of Inheritance
Single Inheritance
Multilevel Inheritance
Multiple Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Abstract Class
Friend Class
Nested Class
Public Inheritance
All public members of the base class become public members of the derived class.
All Protected members of the base class become protected members of the derived
class.
All private members are inaccessible
Protected Inheritance
All public members of the base class become protected members of the derived class.
All Protected members of the base class become protected members of the derived
class.
All private members are inaccessible.
Unit 2 1
, Private Inheritance
All public members of the base class become private members of the derived class.
All Protected members of the base class become private members of the derived class.
All private members are inaccessible
Advantages of Inheritance
1. Reusability
2. Extensibility
3. Data hiding
4. Overriding
Constructor and Destructor in Derived Class
Base_Constructor → Derived_Constructor → Derived_Destructor → Base_Destructor
Types of Inheritance
Single Inheritance
Multilevel Inheritance
Unit 2 2