protected override Pizza CreatePizza(string item) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.SetName("New York style cheese pizza"); } return pizza; }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; if (type.Equals("cheese")) { pizza = new CheesePizza(_pizzaIngredientFactory); pizza.SetName("New York style cheese pizza"); } else if (type.Equals("pepperoni")) { pizza = new PepperoniPizza(_pizzaIngredientFactory); pizza.SetName("New York style pepperoni pizza"); } else if (type.Equals("clam")) { pizza = new ClamPizza(_pizzaIngredientFactory); pizza.SetName("New York style clam pizza"); } return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); switch (type) { case "Cheese": pizza = new CheesePizza(ingredientFactory); pizza.SetName("NY Style Cheese Pizza"); break; case "Clam": pizza = new ClamPizza(ingredientFactory); pizza.SetName("NY Style Clam Pizza"); break; default: pizza = null; break; } return(pizza); }