program 2 week8
#include<iostream>
using namespace std;
char name[10];
int a;
class employee
{
public:
int code;
void getdata()
{
cout<<"enter the name employee\n";
cin>>name;
cout<<"enter the code employee\n";
cin>>code;
}
};
class account :virtual public employee
{
public:
int pay;
void getdata()
{
cout<<"enter the rupees to pay employee\n";
cin>>pay;
}
};
class admin :virtual public employee
{
public:
int exp;
void getdata()
{
cout<<"enter the experience of employee\n";
cin>>exp;
}
};
class master:public admin,public account
{
public:
void getdata()
{
employee::getdata();
account::getdata();
admin::getdata();
}
void showdata()
{
cout<<"name of employee : "<<name<<endl;
cout<<"code of employee : "<<code<<endl;
cout<<"rupees paid to employee : "<<pay<<endl;
cout<<"experience of employee : "<<exp<<endl;
}
void update()
{
do
{
cout<<"\nenter 1 for updating pay\n";
cout<<"enter 2 for updating experince\n";
cout<<"enter 3 for stisfied with details\n";
cin>>a;
if(a==1)
{
account::getdata();
}
else if(a==2)
{
admin::getdata();
}
}while(3!=a);
cout<<"\nAfter update\n\n";
showdata();
}
};
int main()
{
master m;
m.getdata();
cout<<"\nbefore update\n";
m.showdata();
m.update();
}
Comments
Post a Comment