示例#1
0
        public override Pizza createPizza(string type)
        {
            Pizza pizza;

            if (type.Equals("cheese"))
            {
                pizza = new ChicagoStyleCheesePizza();
            }
            else if (type.Equals("greek"))
            {
                pizza = new ChicagoStyleGreekPizza();
            }
            else if (type.Equals("peperoni"))
            {
                pizza = new ChicagoStylePeperoniPizza();
            }
            else if (type.Equals("clam"))
            {
                pizza = new ChicagoStyleClamPizza();
            }
            else if (type.Equals("veggie"))
            {
                pizza = new ChicagoStyleVeggiePizza();
            }
            else
            {
                pizza = new ChicagoStylePeperoniPizza();
            }

            return(pizza);
        }
示例#2
0
        public override Pizza createPizza(string type)
        {
            Pizza pizza = null;
            PizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();

            if (type.Equals("cheese"))
            {
                pizza      = new ChicagoStyleCheesePizza(ingredientFactory);
                pizza.name = "Chicago Style Cheese Pizza";
            }
            else if (type.Equals("pepperoni"))
            {
                pizza      = new PepperoniPizza(ingredientFactory);
                pizza.name = "Chicago Style Pepperoni Pizza";
            }
            else if (type.Equals("clam"))
            {
                pizza      = new ClamPizza(ingredientFactory);
                pizza.name = "Chicago Style Clam Pizza";
            }
            else if (type.Equals("veggie"))
            {
                pizza      = new VeggiePizza(ingredientFactory);
                pizza.name = "Chicago Style Veggie Pizza";
            }

            return(pizza);
        }
示例#3
0
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type == "Cheese")
            {
                pizza = new ChicagoStyleCheesePizza();
            }
            else if (type == "Veggie")
            {
                pizza = new ChicagoStyleVeggiePizza();
            }

            return(pizza);
        }