static void Main(string[] args) { BaseLaptop ToBuy = new HPLaptop(); ToBuy = new MouseItem(ToBuy); ToBuy = new HeadsetItem(ToBuy); ToBuy = new RAMItem(ToBuy, 4); Console.WriteLine("{0}\nDescription: {1}\nPrice: {2}", ToBuy.GetName(), ToBuy.GetDescription(), ToBuy.GetPrice()); Console.ReadKey(); }
static void Main(string[] args) { Laptop laptop = new HPLaptop(); Console.WriteLine("Base mode price is {0}", laptop.GetPrice()); laptop = new GraphicsDecorator(laptop); Console.WriteLine("After adding graphics decorator, price of laptop is {0}", laptop.GetPrice()); laptop = new FullHDScreenDecorator(laptop); Console.WriteLine("After adding full hd screen decorator, price of laptop is {0}", laptop.GetPrice()); }