Simple Single Inheritance
Simple Single Inheritance
Definition: -
A class derived from only one base class is called Single inheritance.
#include<iostream.h>
#include<conio.h>
class A
{
public:
void showA()
{
cout<<"This is class A";
}
};
class B:public A
{
public:
void showB()
{
cout<<"\nThis is class B";
}
};
void main()
{
B B1;
clrscr();
B1.showA();
B1.showB();
getch();
}
OUTPUT:
This is class A
This is class B

0 comments: