1700468022
1700468023
private int salary=0;
1700468024
1700468025
//领导下边有那些下级领导和小兵
1700468026
1700468027
ArrayList<ICorp>subordinateList=new ArrayList<ICorp>();
1700468028
1700468029
//通过构造函数传递领导的信息
1700468030
1700468031
public Branch(String name,String position,int salary){
1700468032
1700468033
this.name=name;
1700468034
1700468035
this.position=position;
1700468036
1700468037
this.salary=salary;
1700468038
1700468039
}
1700468040
1700468041
//增加一个下属,可能是小头目,也可能是个小兵
1700468042
1700468043
public void addSubordinate(ICorp corp){
1700468044
1700468045
this.subordinateList.add(corp);
1700468046
1700468047
}
1700468048
1700468049
//我有哪些下属
1700468050
1700468051
public ArrayList<ICorp>getSubordinate(){
1700468052
1700468053
return this.subordinateList;
1700468054
1700468055
}
1700468056
1700468057
//领导也是人,他也有信息
1700468058
1700468059
public String getInfo(){
1700468060
1700468061
String info=””;
1700468062
1700468063
info=“姓名:”+this.name;
1700468064
1700468065
info=info+”\t职位:”+this.position;
1700468066
1700468067
info=info+”\t薪水:”+this.salary;
1700468068
1700468069
return info;
1700468070
1700468071
}
[
上一页 ]
[ :1.700468022e+09 ]
[
下一页 ]