Inheritance Polymorphism
Inheritance Polymorphism
Contents
2
What is inheritance?
Derived and base class
Inheritance types:
Single level
Multi level
Hierarchical
Multiple
Hybrid
Abstract Classes
Pointer to object
This Pointer
Pointer to derived Class
Virtual Function
Pure Virtual function
Early vs Late binding
In this type of
inheritance the derived
class inherits from a
class, which in turn
inherits from some
other class. The Super
class for one, is sub
class for the other.
}
By: Kanika Sharma
};
Multiple Inheritance
14
In this type of
inheritance a single
derived class may
inherit from two or
more than two base
classes.
In this type of
inheritance, multiple
derived classes inherits
from a single base class.
"Hybrid
Inheritance" is a
method where one or
more types of inheritance
are combined together
and used.
class B: public A
{
private:
virtual void show()
{
cout << "Derived class\n";
} Kanika Sharma
By:
};
Pure Virtual Functions
32