public PizzaMan(PizzaOven pizzaOven) { PizzaOven = pizzaOven; PizzaOven.AddObserver(this); Factory = new PizzaFactory(); PriceStrategy = TimeOfDay.Lunch; EveningPriceStrategy = new EveningPriceStrategy(); LunchPriceStrategy = new LunchPriceStrategy(); NightPriceStrategy = new NightPriceStrategy(); }
static void Main(string[] args) { AbstractPizza pp = new PlainPizza(); pp = new HamDecorator(pp); pp = new BaconDecorator(pp); pp = new PepperoniDecorator(pp); Console.WriteLine(pp); PizzaFactory pf = new PizzaFactory(); Console.WriteLine(pf.MakePizza(new[] { "Pepperoni", "Bacon", "Ham" })); PizzaOven oven = new PizzaOven(); PizzaMan newMan = new PizzaMan(oven); Console.WriteLine(); newMan.TakeOrder(new[] { "Pepperoni", "Bacon" }); newMan.TakeOrder(new[] { "Pepperoni", "Bacon" }, "Cola", 21.0); Console.ReadKey(); }