protected override Pizza CreatePizza(string type)

        {

            Pizza pizza = null;

            IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();



            switch(type)

            {

                case "cheese":

                    pizza = new CheesePizza(ingredientFactory);

                    pizza.Name = "Chicago Style Cheese Pizza";

                    break;

                case "clam":

                    pizza = new ClamPizza(ingredientFactory);

                    pizza.Name = "Chicago Style Clam Pizza";

                    break;

                case "pepperoni":

                    pizza = new PepperoniPizza(ingredientFactory);

                    pizza.Name = "Chicago Style Pepperoni Pizza";

                    break;

            }

            return pizza;

        }
Beispiel #2
0
        protected override Pizza CreatePizza(string type)

        {
            Pizza pizza = null;

            IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();



            switch (type)

            {
            case "cheese":

                pizza = new CheesePizza(ingredientFactory);

                pizza.Name = "Chicago Style Cheese Pizza";

                break;

            case "clam":

                pizza = new ClamPizza(ingredientFactory);

                pizza.Name = "Chicago Style Clam Pizza";

                break;

            case "pepperoni":

                pizza = new PepperoniPizza(ingredientFactory);

                pizza.Name = "Chicago Style Pepperoni Pizza";

                break;
            }

            return(pizza);
        }