#include <iostream>
using namespace std;
class Teacher
{
public:
Teacher(string nam,int ag,string add,string tel,string se,string ti):
name(nam),age(ag),addr(add),telnum(tel),sex(se),title(ti){}
protected:
int age;
string addr,sex,title,name,telnum;
};
class Cadre
{
public:
Cadre(string nam,int ag,string add,string tel,string se,string po):
name(nam),age(ag),addr(add),telnum(tel),sex(se),post(po){}
void display ();
protected:
int age;
string addr,sex,name,telnum,post;
};
class Cadre_Teacher:public Teacher ,public Cadre
{
public:
Cadre_Teacher (string nam,int ag,string add,string tel,string se,string po,string ti,double w):
Cadre(nam,ag,add,tel,se,po),Teacher(nam,ag,add,tel,se,ti),wages(w){}
void show();
protected:
double wages;
};
void Cadre::display()
{
cout<<"name:"<<name<<endl;
cout<<"age:"<<age<<endl;
cout<<"tel:"<<telnum<<endl;
cout<<"sex:"<<sex<<endl;
cout<<"post:"<<post<<endl;
}
void Cadre_Teacher::show ()
{
Cadre::display();
cout<<"title:"<<title<<endl;
cout<<"salary:"<<wages<<endl;
}
int main()
{
Cadre_Teacher C1("shanhongyu",19,"YantaiUnversity","1886555XXXX","man","freshman","stu",100);
C1.show();
return 0;
}
第12周——教师干部类
最新推荐文章于 2021-05-30 14:12:32 发布