Inheritance in C++
Inheritance in C++
NOOR AFSHAN
What is Inheritance?
Public mode: If we derive a sub class from a public base class. Then the public
member of the base class will become public in the derived class and protected
members of the base class will become protected in derived class. Private
members of the base class will never get inherited in sub class.
Protected mode: If we derive a sub class from a Protected base class. Then both
public member and protected members of the base class will become protected in
derived class. Private members of the base class will never get inherited in sub class.
Private mode: If we derive a sub class from a Private base class. Then both public
member and protected members of the base class will become Private in derived
class. Private members of the base class will never get inherited in sub class.
Modes of Inheritance
Types of Inheritance
Single inheritance
Multiple inheritance
Hierarchical inheritance
Multilevel inheritance
Hybrid inheritance
Single Inheritance