示例#1
0
 public override Pizza createPizza(string param)
 {
     Pizza pizza = null;
     if (param == "cheese")
     {
         pizza = new CheesePizza(ing);
         pizza.name = "NY Cheese";
     }
     else if (param == "spice")
     {
         pizza = new SpicePizza(ing);
         pizza.name = "NY Spice";
     }
     return pizza;
 }
        protected override Pizza createPizza(string type)
        {
            Pizza pizza = null;

            IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();
            if (type == "cheese")
            {
                pizza = new CheesePizza(ingredientFactory);
                pizza.setName("Chicago Style Cheese Pizza");
            }
            else if (type == "clam")
            {
                pizza = new ClamPizza(ingredientFactory);
                pizza.setName("Chicago Style Clam Pizza");
            }

            return pizza;
        }