static void Main(string[] args) { //ItalianPizza Pizza pizzaIt1 = new ItalianPizza(); Console.WriteLine("Название: {0}", pizzaIt1.Name); Console.WriteLine("Цена: {0}", pizzaIt1.GetCost()); pizzaIt1 = new PlusTomatoPizza(pizzaIt1); // итальянская пицца с томатами Console.WriteLine("Название: {0}", pizzaIt1.Name); Console.WriteLine("Цена: {0}", pizzaIt1.GetCost()); Pizza pizzaIt2 = new ItalianPizza(); pizzaIt2 = new PlusCheesePizza(pizzaIt2);// итальянская пиццы с сыром Console.WriteLine("Название: {0}", pizzaIt2.Name); Console.WriteLine("Цена: {0}", pizzaIt2.GetCost()); Console.WriteLine(); //BulgerianPizza Pizza pizzaBul = new BulgerianPizza(); Console.WriteLine("Название: {0}", pizzaBul.Name); Console.WriteLine("Цена: {0}", pizzaBul.GetCost()); pizzaBul = new PlusTomatoPizza(pizzaBul); pizzaBul = new PlusCheesePizza(pizzaBul);// болгарская пиццы с томатами и сыром Console.WriteLine("Название: {0}", pizzaBul.Name); Console.WriteLine("Цена: {0}", pizzaBul.GetCost()); Console.ReadLine(); }
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); } }
static void Main(string[] args) { Pizza pizza1 = new ItalianPizza(); Console.WriteLine($"Name '{pizza1.Name}'"); Console.WriteLine($"Cost {pizza1.GetCost()}"); pizza1 = new TomatoPizza(pizza1); Console.WriteLine($"Name '{pizza1.Name}'"); Console.WriteLine($"Cost {pizza1.GetCost()}"); Pizza pizza2 = new ItalianPizza(); pizza2 = new CheesePizza(pizza2); Console.WriteLine($"Name '{pizza2.Name}'"); Console.WriteLine($"Cost {pizza2.GetCost()}"); Pizza pizza3 = new BulgerianPizza(); pizza3 = new CheesePizza(pizza3); pizza3 = new TomatoPizza(pizza3); Console.WriteLine($"Name '{pizza3.Name}'"); Console.WriteLine($"Cost {pizza3.GetCost()}"); }
static void Main(string[] args) { Pizza pizza1 = new ItalianPizza(); pizza1 = new CheesePizza(new TomatoPizza(pizza1)); // итальянская пицца с томатами Console.WriteLine("Название: {0}", pizza1.Name); Console.WriteLine("Цена: {0}", pizza1.GetCost()); Console.WriteLine("Ингридиенты: {0}", pizza1.GetIngridients().Aggregate((s, p) => string.Concat(s, ", ", p))); // Create video Video video = new Video("Spielberg", "Jaws", 23, 92); video.Display(); // Make video borrowable, then borrow and display Console.WriteLine("\nMaking video borrowable:"); Borrowable borrowvideo = new Borrowable(video); borrowvideo.BorrowItem("Customer #1"); borrowvideo.BorrowItem("Customer #2"); borrowvideo.Display(); GunSample(); Console.WriteLine("Agile Book Decorator Sample"); AgileBookSamples.Modem.ModemDecoratorTest.Test(); Console.WriteLine(""); Console.ReadLine(); }
static void Main(string[] args) { Pizza itallianPizza = new ItalianPizza(); itallianPizza = new CheesePizza(itallianPizza); Console.WriteLine($"Name: {itallianPizza.Name}"); Console.WriteLine($"Price: {itallianPizza.GetCost()}"); Console.ReadKey(); }
private static void Main(string[] args) { Pizza p1 = new RanchoPizza(); p1 = new CheeseDecorator(p1); p1 = new MeatDecorator(p1); Console.WriteLine($"Name: {p1.Name}, Cost: {p1.GetCost()}"); Pizza p2 = new ItalianPizza(); p2 = new MeatDecorator(p2); Console.WriteLine($"Name: {p2.Name}, Cost: {p2.GetCost()}");
static void Main(string[] args) { Pizza pizza1 = new ItalianPizza(); pizza1 = new TomatoPizza(pizza1); Console.WriteLine("Name: {0}, price: {1}", pizza1.Name, pizza1.GetCost()); Pizza pizza2 = new ItalianPizza(); pizza2 = new CheesePizza(pizza2); Console.WriteLine("Name: {0}, price: {1}", pizza2.Name, pizza2.GetCost()); Pizza pizza3 = new BulgerianPizza(); pizza3 = new TomatoPizza(pizza3); pizza3 = new CheesePizza(pizza3); Console.WriteLine("Name: {0}, price: {1}", pizza3.Name, pizza3.GetCost()); Console.ReadLine(); }
static void Main(string[] args) { Pizza pizza1 = new ItalianPizza(); pizza1 = new TomatoPizza(pizza1); // итальянская пицца с томатами Console.WriteLine("Название: {0}", pizza1.Name); Console.WriteLine("Цена: {0}", pizza1.GetCost()); Pizza pizza2 = new ItalianPizza(); pizza2 = new CheesePizza(pizza2);// итальянская пиццы с сыром Console.WriteLine("Название: {0}", pizza2.Name); Console.WriteLine("Цена: {0}", pizza2.GetCost()); Pizza pizza3 = new BulgerianPizza(); pizza3 = new TomatoPizza(pizza3); pizza3 = new CheesePizza(pizza3);// болгарская пицца, с томатами, с сыром Console.WriteLine("Название: {0}", pizza3.Name); Console.WriteLine("Цена: {0}", pizza3.GetCost()); }
static void Main() { Pizza pizza1 = new ItalianPizza(); pizza1 = new TomatoPizza(pizza1); Console.WriteLine($"Name: {pizza1.Name}"); Console.WriteLine($"Цена: {pizza1.GetCost()}"); Pizza pizza2 = new ItalianPizza(); pizza2 = new CheesePizza(pizza2); Console.WriteLine($"Name: {pizza2.Name}"); Console.WriteLine($"Price: {pizza2.GetCost()}"); Pizza pizza3 = new ChicagoPizza(); pizza3 = new TomatoPizza(pizza3); pizza3 = new CheesePizza(pizza3); Console.WriteLine($"Name: {pizza3.Name}"); Console.WriteLine($"Price: { pizza3.GetCost()}"); Console.ReadLine(); }