Ejemplo n.º 1
0
        public override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            switch (type)
            {
            case "cheese":
                pizza = new NYStyleCheesePizza();
                break;

            case "pepperoni":
                pizza = new NYStylePepperoniPizza();
                break;

            case "clam":
                pizza = new NYStyleClamPizza();
                break;

            case "veggie":
                pizza = new NYStyleVeggiePizza();
                break;

            default:
                Console.WriteLine("default switch case");
                break;
            }

            return(pizza);
        }
Ejemplo n.º 2
0
        public override Pizza CreatePizza(string vsType)
        {
            Pizza oPizza = null;

            if (vsType == "cheese")
            {
                oPizza = new NYStyleCheesePizza();
            }
            else if (vsType == "pepperoni")
            {
                oPizza = new NYStylePepperoniPizza();
            }
            else if (vsType == "clam")
            {
                oPizza = new NYStyleClamPizza();
            }
            else if (vsType == "veggie")
            {
                oPizza = new NYStyleVeggiePizza();
            }
            else
            {
                // Should throw an exception
            }
            return(oPizza);
        }