コード例 #1
0
        public override Pizza CreatePizza(String item)
        {
            Pizza pizza = null;

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

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

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

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

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

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

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

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

                case "pepperoni":
                    pizza = new NYStylePepperoniPizza();
                    break;
                }
            }
            else if (style == "Chicago")
            {
                switch (type)
                {
                case "cheese":
                    pizza = new ChicagoStyleCheesePizza();
                    break;

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

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

                case "pepperoni":
                    pizza = new ChicagoStylePepperoniPizza();
                    break;
                }
            }
            else
            {
                Console.WriteLine("Error: invalid store");
                return(null);
            }
            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
コード例 #3
0
ファイル: PizzaTestDrive.cs プロジェクト: ronymaychan/demos
        public override Pizza CreatePizza(String item)
        {
            Pizza pizza = null;

            switch (item)
            {
                case "cheese":
                    pizza = new NYStyleCheesePizza();
                    break;
                case "veggie":
                    pizza = new NYStyleVeggiePizza();
                    break;
                case "clam":
                    pizza = new NYStyleClamPizza();
                    break;
                case "pepperoni":
                    pizza = new NYStylePepperoniPizza();
                    break;
            }

            return pizza;
        }
コード例 #4
0
ファイル: PizzaTestDrive.cs プロジェクト: ronymaychan/demos
        public Pizza CreatePizza(string style, string type)
        {
            Pizza pizza = null;

            if (style == "NY")
            {
                switch (type)
                {
                    case "cheese":
                        pizza = new NYStyleCheesePizza();
                        break;
                    case "veggie":
                        pizza = new NYStyleVeggiePizza();
                        break;
                    case "clam":
                        pizza = new NYStyleClamPizza();
                        break;
                    case "pepperoni":
                        pizza = new NYStylePepperoniPizza();
                        break;
                }
            }
            else if (style == "Chicago")
            {
                switch (type)
                {
                    case "cheese":
                        pizza = new ChicagoStyleCheesePizza();
                        break;
                    case "veggie":
                        pizza = new ChicagoStyleVeggiePizza();
                        break;
                    case "clam":
                        pizza = new ChicagoStyleClamPizza();
                        break;
                    case "pepperoni":
                        pizza = new ChicagoStylePepperoniPizza();
                        break;
                }
            }
            else
            {
                Console.WriteLine("Error: invalid store");
                return null;
            }
            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return pizza;
        }