Académique Documents
Professionnel Documents
Culture Documents
PADMA LAKSHMI ,PGT,DAV PUBLIC SCHOOL, BISTUPUR FOR THE BATCH XIIA1
AND XII-A3 -2019 Page 1
INHERITANCE
1. THE MECHANISM OF inheriting properties from one class to another class is
known as “inheritance”.
2. The class whichever is inherited from another class is known as derived class or
sub class
3. The class from which derived class is derived is known as base or super class
-Single : -Deriving one derived class from single base class is known as single
inheritance
-Multiple: -Deriving the derived class from more than 1 base class is known as
multiple inheritance
-Hierarchical:-Deriving more than one derived class from single base class is
known as hierarchical class
1)private-when the derived class is derived privately ,private members are not
inherited both public and protected members will be inherited to private access
specifier of derived class.
2)public-when the derived class is derived publicly, private members are not
inherited ,protected members of the base class will become protected members
of the derived class and public members of the base class will be public members
of the derived class.
Private X X X
*THE object of derived class is only created that’s why the object of the base class
cannot be created thats why it is known as Abstract Class
Class number
{
Int no1;
Public:
Int no2,no3;
Protected:
Int no4;
};
{ /*public-int no2,no3
Int p;
};
Int 2 bytes
Short 2bytes
Long 4bytes
Char 1byte
Float 4bytes
Double 8bytes