The process of defining a new class in terms of existing class is called inheritance. The existing class is called the base class and new class is called the derived class.
It is a concept of linking two or more classes with each other in a hierarchical manner so that their properties and functions can be shared. The public and protected members of the base class will be inherited and are accessible in the derived class depending upon the visibility mode.
This leads to the biggest advantage of re-usability of the members and avoids redundancy.
TYPES OF INHERITANCE
When one class is inherited from a single base class.
Here A is the base class and B is the derived class of A.
In this type,two classes are derived from a single base case.
A ---- B
Here A is the base class of two derived classES i.e. B and C
In this a new class is inherited from two base classes.
Here C is the derived class of A and B.
Here A is the base class of B and B is the base class of A.
It is the combination of two or more types of inheritance.
Teacher( ) ;
void TEntry( ) ;
void TDisplay( );
void SEntry( );
void SDisplay( );
class School : public Student, public Teacher
School ( ) ;
void SchEntry( );
void SchDisplay( );