#include<iostream.h>
#include<conio.h>
class base
{
private:
int a;
public:
void getdatab(int x)
{
a=x;
}
void displayb()
{
cout<<"\n base value is="<<a;
}
} ;
class derive : public base // Single Inheritence
{
private:
int b;
public:
{
b=y;
}
void displayd()
{
cout<<"\n derive value is="<<b;
}
{
cout<<"Destructor Fired";
}
} ;
main()
{
clrscr();
derive d1(7);
d1.getdatab(5);
d1.displayb();
d1.displayd();
getch();
}
No comments:
Post a Comment