static void Main(string[] args) { Pizza.Pizza[] pizzas = new Pizza.Pizza[2]; //Создания итальянской и французкой пиццы pizzas[0] = new ItalianPizza(); pizzas[1] = new FrancePizza(); foreach (var pz in pizzas) { PrintPizza(pz); } // Добавление сыра и мяса в итальянскую пиццу pizzas[0] = new Cheese(pizzas[0]); pizzas[0] = new Meat(pizzas[0]); // Добавление ананаса и соуса во французкую пиццу pizzas[1] = new Pine(pizzas[1]); pizzas[1] = new Sauce(pizzas[1]); foreach (var pz in pizzas) { PrintPizza(pz); } }
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) { IPizza PlainPizza = new PlainPizza(); IPizza Ananas = new Ananas(PlainPizza); Console.WriteLine(Ananas.GetPizzaType() + "\n\r Total cost: " + Ananas.GetCost() + " DKK"); IPizza CalzonePizza = new CalzonePizza(); IPizza sananas = new Ananas(CalzonePizza); IPizza smeat = new Meat(sananas); IPizza schees = new Cheese(smeat); Console.WriteLine(schees.GetPizzaType() + "\n\r Total cost: " + schees.GetCost() + " DKK"); }