Ejemplo n.º 1
0
        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()}");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "Decorator";

            Pizza pizza1 = new ItallianPizza();

            pizza1 = new TomatoPizza(pizza1); // итальянская пицца с томатами
            Console.WriteLine($"Название: {pizza1.Name}");
            Console.WriteLine($"Цена: {pizza1.GetCost()}");

            Pizza pizza2 = new ItallianPizza();

            pizza2 = new CheesePizza(pizza2);// итальянская пиццы с сыром
            Console.WriteLine($"Название: {pizza2.Name}");
            Console.WriteLine($"Цена: {pizza2.GetCost()}");

            Pizza pizza3 = new BulgerianPizza();

            pizza3 = new TomatoPizza(pizza3);
            pizza3 = new CheesePizza(pizza3);// болгарская пиццы с томатами и сыром
            Console.WriteLine($"Название: {pizza3.Name}");
            Console.WriteLine($"Цена: {pizza3.GetCost()}");


            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Pizza pizza = new BulgerianPizza();

            pizza = new TomatoPizza(pizza);
            pizza = new CheesPizza(pizza);
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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());
        }
Ejemplo n.º 6
0
        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();
        }