コード例 #1
0
        internal override Pizza CreatePizza(string item)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

            if (item.Equals("cheese"))
            {
                pizza      = new CheesePizza(ingredientFactory);
                pizza.Name = "California Style Cheese Pizza";
            }
            else if (item.Equals("veggie"))
            {
                pizza      = new VeggiePizza(ingredientFactory);
                pizza.Name = "California Style Veggie Pizza";
            }
            else if (item.Equals("clam"))
            {
                pizza      = new ClamPizza(ingredientFactory);
                pizza.Name = "California Style Clam Pizza";
            }
            else if (item.Equals("pepperoni"))
            {
                pizza      = new PepperoniPizza(ingredientFactory);
                pizza.Name = "California Style Pepperoni Pizza";
            }

            return(pizza);
        }
コード例 #2
0
        public Pizza CreatePizza(String type)
        {
            Pizza Pizza=null;
            IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

            if (type == "cheese")
            {
              Pizza=new NYStyleCheesePizza(ingredientFactory);
              Pizza.Name = "New York style cheese pizza";
            }

            return Pizza;
        }
コード例 #3
0
        public Pizza CreatePizza(String type)
        {
            Pizza Pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

            if (type == "cheese")
            {
                Pizza      = new NYStyleCheesePizza(ingredientFactory);
                Pizza.Name = "New York style cheese pizza";
            }


            return(Pizza);
        }