#include <iostream>
using namespace std;
class base
{
char *name;
char *age;
public:
base(char*&n,char*&a){
name=n;
age=a;
cout<<"construction base base. "<<endl;
}
void show(){
cout<<"姓名:"<<name<<"\t年龄:"<<age<<endl;
}
~base(){
cout<<"destrutor base base."<<endl;
}
};
class leader: virtual public base
{ char *post;
char *department;
public:
leader(char*&n,char*&a,char*&p,char*&d):base(n,a)
{
post=p;
department=d;
cout<<"construction base leader"<<endl;
}
void showl(){
show();
cout<<"职务:"<<post<<"\t所在部门:"<<department<<endl;
}
~leader()
{
cout<<"destrutor base leader"<<endl;
}
};
class engineer: virtual public base
{
char*epost;
char*major;
public:
engineer(char*&t,char*&r,char*&e,char*&m):base(t,r){
epost=e;
major=m;
cout<<"construction base engineer"<<endl;
}
void showm(){
cout<<"职称:"<<epost<<"\t专业:"<<major<<endl;
}
~engineer()
{
cout<<"destrutor base engineer"<<endl;
}
};
class chairman_engineer:public leader,public engineer
{
public:
chairman_engineer(char*&a,char*&b,char*&c,char*&d,char*&t,char*&r,char*&e,char*&f):leader(a,b,c,d),engineer(t,r,e,f)
{
cout<<"construction base chairman_engineer"<<endl;
}
void showc()
{
showl();
showm();
}
~chairman_engineer(){
cout<<"destrutor base chairman_engineer"<<endl;
}
};
void main()
{
char *n[6]={"王健","34","经理","工程预算部","高级会计工程师","会计工程专业"};
chairman_engineer b(n[0],n[1],n[2],n[3],n[0],n[1],n[4],n[5]);
b.showc();
}