#include <iostream>
using namespace std;
class student
{
private:
string name;
int age;
float score;
public:
student() {cout<<"student 无参构造"<<endl;}
//构造
student(string name, int age, float score):name(name),age(age),score(score) {cout<<"student 有参构造"<<endl;}
//析构
~student(){};
void show()
{
cout<<"name = "<<name<<" age= "<<age<<" score = "<<score<<endl;
}
};
class party
{
private:
string dang_act;
string team;
public:
party() {cout<<"party 无参构造"<<endl;}
//构造
party(string dang_act, string team):dang_act(dang_act),team(team) {cout<<"party 有参构造"<<endl;}
//析构
~party(){};
void show()
{
cout<<"dang_act = "<<dang_act<<" team= "<<team<<endl;
}
};
//:public student,public party
class leader:public student, public party
{
private:
string job;
public:
//构造
leader() {}
leader(string name, int age, float score,string dang_act, string team,string job) :student(name, age, score),party(dang_act, team),job(job) {}
void show()
{
// this->student::show();
// this->party::show();
student::show();
party::show();
cout<<"job = "<<job<<endl;
}
};
int main()
{
leader l1("zpp", 50, 99.3, "hqyj", "2023021", "teacher");
l1.show();
return 0;
}