using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DecoratorPattern { /// /// 抽象房类 /// public abstract class AbstractHouse { /// /// 面积 /// public double Area { get; set; } /// /// 规格 /// public string Specification { get; set; } /// /// 价格 /// public decimal Price { get; set; } /// /// 定义抽象方法--展示 /// public abstract void Show(); } /// /// 未装修房 -- 毛坯房 /// public class WithoutDecoratorHouse : AbstractHouse { /// /// 毛坯房就做简要展示 /// public override void Show() { Console.WriteLine(string.Format("该户型为{0}㎡,户型设计为{1},目前均价为{2}元/㎡。", this.Area, this.Specification, this.Price)); } } }