/// <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); }
/// <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); }