Program -
#include<iostream.h>
#include<conio.h>
class abc
{
public:
char name[19];
char address[29];
virtual void
add()=0;
virtual void
display()=0;
};
class xyz:public
abc
{
private:
int fees;
public:
void add()
{
cout<<"\n
enter the name";
cin>>name;
cout<<"\n
enter the address";
cin>>address;
cout<<"\n
enter the fees";
cin>>fees;
}
void display()
{
cout<<"\n
name is "<<name;
cout<<"\n
address is"<<address;
cout<<"\n
fees is"<<fees;
}
};
void main()
{
class xyz m1;
clrscr();
m1.add();
m1.display();
getch();
}
Output -
enter the name sushma
enter the address mukerian
enter the fees32000
name is sushma
address is mukerian
fees is32000
0 comments:
Post a Comment