예제 #1
0
        /// <summary>
        /// Фабричный метод (порождающий)
        /// </summary>
        static void FactoryMethod()
        {
            PizzaStore client = new UkrainianPizzaStore(new UkrainePizzaFactory());

            Pizza pizza = client.OrderPizza("Papperony"); //with factory method

            Console.WriteLine("Pizza Name - {0}, PizzaWeight - {1}", pizza.Name, pizza.Weight);
        }
예제 #2
0
        /// <summary>
        /// Абстрактная фабрика (порождающий)
        /// </summary>
        static void AbstractFactory()
        {
            PizzaStore client = new UkrainianPizzaStore(new UkrainePizzaFactory());

            Pizza pizza = client.OrderPizza(); //with abstract factory

            Console.WriteLine("Pizza Name - {0}, PizzaWeight - {1}", pizza.Name, pizza.Weight);
        }