示例#1
0
        static void Main(string[] args)
        {
            PizzaStore nyStore      = new NYPizzaStore();
            PizzaStore chicagoStore = new ChicagoPizzaStore();

            Pizza pizza = nyStore.orderPizza("veggie");

            Console.WriteLine("Ethan ordered a " + pizza.getName() + "\n");

            pizza = chicagoStore.orderPizza("cheese");
            Console.WriteLine("Joel ordered a " + pizza.getName() + "\n");
        }
示例#2
0
        static void Main(string[] args)
        {
            SimplePizzaFactory factory = new SimplePizzaFactory();
            PizzaStore         store   = new PizzaStore(factory);

            Pizza pizza = store.orderPizza("cheese");

            Console.WriteLine("We ordered a " + pizza.getName() + "\n");
            Console.WriteLine(pizza);

            pizza = store.orderPizza("veggie");
            Console.WriteLine("We ordered a " + pizza.getName() + "\n");
            Console.WriteLine(pizza);

            pizza = store.orderPizza("pepperoni");
            Console.WriteLine("We ordered a " + pizza.getName() + "\n");
            Console.WriteLine(pizza);

            Console.ReadKey();
        }