1700467496
1700467497
//根节点的职位
1700467498
1700467499
private String position=””;
1700467500
1700467501
//根节点的薪水
1700467502
1700467503
private int salary=0;
1700467504
1700467505
//通过构造函数传递进来总经理的信息
1700467506
1700467507
public Root(String name,String position,int salary){
1700467508
1700467509
this.name=name;
1700467510
1700467511
this.position=position;
1700467512
1700467513
this.salary=salary;
1700467514
1700467515
}
1700467516
1700467517
//增加树枝节点
1700467518
1700467519
public void add(IBranch branch){
1700467520
1700467521
this.subordinateList.add(branch);
1700467522
1700467523
}
1700467524
1700467525
//增加叶子节点,比如秘书,直接隶属于总经理
1700467526
1700467527
public void add(ILeaf leaf){
1700467528
1700467529
this.subordinateList.add(leaf);
1700467530
1700467531
}
1700467532
1700467533
//得到自己的信息
1700467534
1700467535
public String getInfo(){
1700467536
1700467537
String info=””;
1700467538
1700467539
info=“名称:”+this.name;
1700467540
1700467541
info=info+”\t职位:”+this.position;
1700467542
1700467543
info=info+”\t薪水:”+this.salary;
1700467544
1700467545
return info;
[
上一页 ]
[ :1.700467496e+09 ]
[
下一页 ]