Program to implement the concept of abstract base class with all its functions as pure virtual functions.

#include
#include
class trial
{
public:
virtual void getdata()=0;
virtual void display()=0;
};
class basic:public trial
{
private:
int x;
public:
void getdata()
{
cout<>x;
}
void display()
{
cout<<"n Entered Value of X was : "<<x<<"n";
}
};

class salary:public basic
{
private:
int x;
public:
void getdata()
{
cout<>x;
}
void display()
{
cout<<"n Entered Value of X of salary was : "<getdata();
p->display();
p=&b;
p->getdata();
p->display();
getch();
}

Leave a reply