#include <iostream>
#include <string>
using namespace std;
class base{
private:
string name;
int old;
public:
base(string name1,int old1)
{
name=name1;
old=old1;
}
void print()
{
cout<<"姓名为:"<<name<<endl;
cout<<"年龄为:"<<old<<endl;
}
};
class leader:virtual public base{
public:
string position;
string department;
public:
leader(string name1,int old1,string position1,string department1):base(name1,old1)
{
position=position1;
department=department1;
/*}
void print()
{*/
base::print();
cout<<"职务为:"<<position<<endl;
cout<<"部门为:"<<department<<endl;
}
};
class engineer:virtual public base{
private:
string job_name;
string major;
public:
engineer(string name1,int old1,string job_name1,string major1):base(name1,old1)
{
job_name=job_name1;
major=major1;
/*}
void print()
{
base::print();*/
cout<<"职称为:"<<job_name<<endl;
cout<<"专业为:"<<major<<endl;
}
};
class chairman:public leader,public engineer{
public:
chairman(string name1,int old1,string position1,string department1,string job_name1,string major1):base(name1,old1),leader(name1,old1,position1,department1),engineer(name1,old1,job_name1,major1)
{
//print();
}
/*void print()
{
base::print();
leader::print();
engineer::print();
}*/
};
int main()
{
cout<<"chairman的信息为:"<<endl;
chairman C("zhang",25,"director","engineer department","director chairman","engineer science");
return 0;
}