5.19管理

#include<iostream>
#include<string>
using  namespace  std;
class  base{
public:
base(string name1,string age1)
{name=name1;
age=age1;
}
void print()
{cout<<"姓名:"<<name<<endl;
cout<<"年龄:"<<age<<endl;
}
private:
string  name;
string  age;
};
class leader:virtual  public  base{
public:
leader(string name1,string age1,string prof1,string dept1):
 base(name1,age1)
 {prof=prof1;
 dept=dept1;
 }
 void print()
 {base::print();
 cout<<"职务:"<<prof<<endl;
 cout<<"部门:"<<dept<<endl;
 }
private:
string prof;
string  dept;
};
class engieer:virtual  public base{
public:
engieer(string name1,string  age1,string work1,string profe1):
 base(name1,age1)
 {work=work1;
 profe=profe1;
 }
 void print()
 {base::print();
 cout<<"职称:"<<work<<endl;
 cout<<"专业:"<<profe<<endl;
 }
private:
string work;
string  profe;
};
class chairman:public leader,public engieer{
public:
chairman(string name1,string age1,string prof1,string dept1,string work1,string profe1):
 base(name1,age1),leader(name1,age1,prof1,dept1),engieer(name1,age1,work1,profe1)
 { work=work1;
 profe=profe1;}
 void print()
 {leader::print();
 cout<<"职称:"<<work<<endl;
 cout<<"专业:"<<profe<<endl;}
 
private:
string work;
string profe;
};
int  main()
{  leader   leader1("Mr.lin","38","财务主管","财务部");
leader1.print();
   engieer  engieer1("Mr.li","28","IT工程师","IT");
   engieer1.print();
   chairman  chairman1("Mr.ma","38","IT部主任","IT部","主任","IT");
   chairman1.print();
   return 0;
}
   





评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值