using System; namespace CompositePattern.Abstractions { public abstract class MenuComponent { public virtual void Add(MenuComponent menuComponent) { throw new NotSupportedException(); } public virtual void Remove(MenuComponent menuComponent) { throw new NotSupportedException(); } public virtual MenuComponent GetChild(int i) { throw new NotSupportedException(); } public virtual string Name => throw new NotSupportedException(); public virtual string Description => throw new NotSupportedException(); public virtual double Price => throw new NotSupportedException(); public virtual bool IsVegetarian => throw new NotSupportedException(); public virtual void Print() { throw new NotSupportedException(); } } }
使用C# (.NET Core) 实现组合设计模式 (Composite Pattern) (2)
内容版权声明:除非注明,否则皆为本站原创文章。