public static void Main(string[] args) { IPizza pizza = new SimplyVegPizza(); Console.WriteLine(pizza); pizza = new RomaTomatoes(pizza); Console.WriteLine(pizza); pizza = new GreenOlives(pizza); Console.WriteLine(pizza); pizza = new Spinach(pizza); Console.WriteLine(pizza); pizza = new SimplyNonVegPizza(); Console.WriteLine(pizza); pizza = new Meat(pizza); Console.WriteLine(pizza); pizza = new Cheese(pizza); Console.WriteLine(pizza); pizza = new Ham(pizza); Console.WriteLine(pizza); }
static void Main(string[] args) { var fullPizza = new Ham(new Cheese(new PlainPizza())); Console.WriteLine($"Pizza description: {fullPizza.GetDescription()}"); Console.WriteLine($"Cost: { fullPizza.GetCost()},"); Console.ReadKey(); }
private static void Main(string[] args) { Hamburger largeHamburger = new BlueStack(); largeHamburger = new Cheese(largeHamburger); largeHamburger = new Ham(largeHamburger); largeHamburger = new Peppers(largeHamburger); Console.WriteLine(largeHamburger.GetDescription()); Console.WriteLine("{0:C2}", largeHamburger.CalculateCost()); Console.ReadKey(); }
private static void Main() { Pizza largePizza = new LargePizza(); largePizza = new Cheese(largePizza); largePizza = new Ham(largePizza); largePizza = new Peppers(largePizza); Console.WriteLine($"Pizza Description: {largePizza.GetDescription()}"); Console.WriteLine($"Pizza Price: {largePizza.GetPrice()}"); Console.ReadKey(); }