要求:
#include <iostream>
#include <string>
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){}
~Student(){}
void show()
{
cout<<"name:"<<name<<endl;
cout<<"age"<<age<<endl;
cout<<"score"<<score<<endl;
}
};
class Leader
{
protected:
string post;
int salary;
public:
Leader(){}
Leader(string p,int sa):post(p),salary(sa){}
~Leader(){}
void show()
{
cout<<"name:"<<endl;
}
};
class StuLeader: public Student,public Leader
{
private:
int managernum;
public:
StuLeader(){};
StuLeader(string n,int a,double s,string p,int sa,int m):Student(n,a,s),Leader(p,sa),managernum(m){}
void show()
{
cout<<"name:"<<name<<endl<<"age:"<<Student::age<<endl<<"score:"<<score<<endl<<"post:"<<post<<endl<<"salary:"<<salary<<endl<<"managernum:"<<managernum<<endl;
}
};
int main()
{
StuLeader sl1("zty",24,148,"baga",0,0);
sl1.show();
return 0;
}