コード例 #1
0
        public override Pizza createPizza(string type)
        {
            Pizza pizza;


            if (type.Equals("cheese"))
            {
                pizza = new NYStyleCheesePizza();
            }
            else if (type.Equals("greek"))
            {
                pizza = new NYStyleGreekPizza();
            }
            else if (type.Equals("peperoni"))
            {
                pizza = new NYStylePeperoniPizza();
            }
            else if (type.Equals("clam"))
            {
                pizza = new NYStyleClamPizza();
            }
            else if (type.Equals("veggie"))
            {
                pizza = new NYStyleVeggiePizza();
            }
            else
            {
                pizza = new NYStylePeperoniPizza();
            }


            return(pizza);
        }
コード例 #2
0
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type == "Cheese")
            {
                pizza = new NYStyleCheesePizza();
            }
            else if (type == "Veggie")
            {
                pizza = new NYStyleVeggiePizza();
            }

            return(pizza);
        }