示例#1
0
        static void Main()
        {
            // Pizza
            Console.WriteLine("Yankees fan orders:");
            var yankees = new NyPizzaFactory();

            yankees.Order("Cheese");
            Console.WriteLine();
            Console.WriteLine("Cubs fan orders:");
            var cubs = new ChicagoPizzaFactory();

            cubs.Order("Clam");
            Console.WriteLine();
            //Monument
            MonumentHandler greekMonumentHandler =
                new MonumentHandler(new GreekMonumentFactory(), "Athena", "Pericles");

            greekMonumentHandler.IssueMessages();
            // The Olympian deity Athena demands tribute!
            // The noble Greek leader Pericles requests submission of taxes!

            MonumentHandler egyptianMonumentHandler =
                new MonumentHandler(new EgyptianMonumentFactory(), "Sekhmet", "Hatchepsut");

            egyptianMonumentHandler.IssueMessages();
            // Now accepting offerings to the Egyptian deity Sekhmet!
            // The mighty Egyptian pharaoh Hatchepsut demands payment of taxes!
        }
示例#2
0
        private static void Main()
        {
            Console.WriteLine("Yankees fan orders:");
            var yankees = new NyPizzaFactory();

            yankees.Order("Cheese");
            Console.WriteLine();
            Console.WriteLine("Cubs fan orders:");
            var cubs = new ChicagoPizzaFactory();

            cubs.Order("Clam");
        }