Exemplo n.º 1
0
 protected override Pizza CreatePizza(string type)
 {
     Pizza pizza = null;
     switch (type)
     {
         case "cheese":
             pizza = new CheesePizza();
             break;
         case "clam":
             pizza = new ClamPizza();
             break;
         case "pepperoni":
             pizza = new PepperoniPizza();
             break;
         case "veggie":
             pizza = new VeggiePizza();
             break;
     }
     return pizza;
 }
Exemplo n.º 2
0
        public static Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type.Equals("cheese"))
            {
                pizza = new CheesePizza();
            }
            else if (type.Equals(""))
            {
                pizza = new PepperoniPizza();
            }
            else if (type.Equals("clam"))
            {
                pizza = new ClamPizza();
            }
            else if (type.Equals("veggie"))
            {
                pizza = new VeggiePizza();
            }
            return pizza;
        }