コード例 #1
0
ファイル: PizzaFactory.cs プロジェクト: bgokoglu/HFPatterns
        public Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type == "Cheese")
                pizza = new CheesePizza();
            else if (type == "Clam")
                pizza = new ClamPizza();
            else if (type == "Suede")
                pizza = new ShoePizza();

            return pizza;
        }
コード例 #2
0
ファイル: PizzaStore.cs プロジェクト: bgokoglu/HFPatterns
        // portland-style preparation for all pizzas
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;
            IIngredientFactory ingredientFactory =
                new PortlandIngredientFactory();

            if (type == "Cheese")
                pizza = new CheesePizza(ingredientFactory);
            else if (type == "Clam")
                pizza = new ClamPizza(ingredientFactory);
            else if (type == "Suede")
                pizza = new ShoePizza(ingredientFactory);

            return pizza;
        }
コード例 #3
0
        public Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type == "Cheese")
            {
                pizza = new CheesePizza();
            }
            else if (type == "Clam")
            {
                pizza = new ClamPizza();
            }
            else if (type == "Suede")
            {
                pizza = new ShoePizza();
            }

            return(pizza);
        }
コード例 #4
0
        // hillsboro-style preparation for all pizzas
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;
            IIngredientFactory ingredientFactory =
                new HillsboroIngredientFactory();

            if (type == "Cheese")
            {
                pizza = new CheesePizza(ingredientFactory);
            }
            else if (type == "Clam")
            {
                pizza = new ClamPizza(ingredientFactory);
            }
            else if (type == "Suede")
            {
                pizza = new ShoePizza(ingredientFactory);
            }

            return(pizza);
        }