public IPizza createPepperInstansce(IPizza pizza, decimal cout) { for (int i = 0; i < cout; i++) { pizza = new PepperDecorator(pizza); } return(pizza); }
static void Main(string[] args) { ChickenPizza chickenPizza = new ChickenPizza(); TomatoPizza tomatoPizza = new TomatoPizza(); CheeseDecorator cheeseDecorator = new CheeseDecorator(chickenPizza); Console.WriteLine(cheeseDecorator.DoPizza()); PepperDecorator pepperDecorator = new PepperDecorator(cheeseDecorator); Console.WriteLine(pepperDecorator.DoPizza()); Console.ReadKey(); }