public static string GetParentTreeInfo(AbstractCorp sub) { string info = $"{sub.GetInfo() } 的领导 \n\t"; if (sub.GetParent() is AbstractCorp parent) { info += GetParentTreeInfo(parent); } return(info); }
public override void Remove(AbstractCorp component) { _subordinateList.Remove(component); }
//增加一个下属,可能是小头目,也可能是个小兵 public override void Add(AbstractCorp component) { component.SetParent(this); //设置父节点 _subordinateList.Add(component); }
public override void Remove(AbstractCorp component) { throw new System.NotImplementedException(); }
//删除一个叶子构件或树枝构件 public abstract void Remove(AbstractCorp component);
//增加一个叶子构件或树枝构件 public abstract void Add(AbstractCorp component);
//设置父节点 public void SetParent(AbstractCorp _parent) { this._parent = _parent; }