#include <iostream>
using namespace std;
class Student
{
protected:
string name;
int age;
double score;
public:
Student() {}//无参构造
Student(string n,int a,double s):name(n),age(a),score(s){}//有参构造
};
class Teacher
{
protected:
int age;
string tital;
public:
Teacher() {}//无参构造
Teacher(int a,string t):age(a),tital(t){}//有参构造
void show()
{
cout<<"年龄:"<<age<<endl;
cout<<"职称:"<<tital<<endl;
}
};
class Graduate:public Student,public Teacher
{
protected:
string sex;
public:
Graduate(string n,int stu_a,double s,int tea_a,string t,string se):Student(n,stu_a,s),Teacher(tea_a,t),sex(se){}
void show()
{
cout<<"姓名:"<<this->name<<endl;
cout<<"年龄:"<<this->Student::age<<endl;
cout<<"成绩:"<<this->score<<endl;
cout<<"性别:"<<this->sex<<endl;
cout<<"老师年龄:"<<this->Teacher::age<<endl;
cout<<"老师职称:"<<this->tital<<endl;
}
};
int main()
{
Graduate G("chen",18,100,55,"yuanzhang","man");
G.show();
return 0;
}