Home | Computer Science

<
Inheritance

Defination

Inheritance is used to inherit other class.


Inheritance Syntax of it is
class abc{
};
class abc1:public abc{
};
Three are mainly Four Types of Inheritance

Some important information

Basic Program
INPUT

#include <iostream> #include<conio.h> class abc{ public: void add() { cout<<"Hello"; } }; class abc2:public abc{ public: void sub() { add(); } }; main() { abc2 a1; a1.sub(); getch(); }

OUTPUT