コード例 #1
0
ファイル: NYPizzaStore.cs プロジェクト: xuejiaW/Study-Notes
        protected override Pizza createPizza(string type)
        {
            Pizza pizza = null;

            if (type.Equals("cheese"))
            {
                pizza = new NYStyleCheesePizza();
            }
            else if (type.Equals("sauce"))
            {
                pizza = new NYStyleSausePizza();
            }
            return(pizza);
        }
コード例 #2
0
        //public NYPizzaStore(SimplePizzaFactory factory) : base(factory)
        //{
        //    Console.WriteLine("NYPizzaStore!!");
        //}

        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

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

            return(pizza);
        }