/// <summary> /// 实现父类的 抽象方法. /// </summary> /// <param name="c"></param> public override void Remove(Component c) { ConsoleColor oldColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("叶子结点无法 删除子节点, 因为不存在!"); Console.ForegroundColor = oldColor; }
/// <summary> /// 实现父类的 抽象方法. /// </summary> /// <param name="c"></param> public override void Add(Component c) { ConsoleColor oldColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("叶子结点无法 追加子节点, 因为不能加!"); Console.ForegroundColor = oldColor; }
/// <summary> /// 实现父类的 抽象方法. /// </summary> /// <param name="c"></param> public override void Remove(Component c) { children.Remove(c); }
/// <summary> /// 实现父类的 抽象方法. /// </summary> /// <param name="c"></param> public override void Add(Component c) { children.Add(c); }
/// <summary> /// 抽象的方法 /// /// 删除叶子结点. /// </summary> /// <param name="c"></param> public abstract void Remove(Component c);
/// <summary> /// 抽象的方法 /// /// 追加叶子结点. /// </summary> /// <param name="c"></param> public abstract void Add(Component c);