示例#1
0
        static void Main(string[] args)
        {
            //ecosystem Africa
            ContinentFactory factory1   = new AfricaFactory();
            Ecosystem        ecosystem1 = new Ecosystem(factory1);

            ecosystem1.Run();

            //ecosystem Australia
            ContinentFactory factory2   = new AustraliaFactory();
            Ecosystem        ecosystem2 = new Ecosystem(factory2);

            ecosystem2.Run();

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            // Create and run the African animal world

            ContinentFactory australia = new AustraliaFactory();
            AnimalWorld      world     = new AnimalWorld(australia);

            world.RunFoodChain();

            // Create and run the American animal world

            ContinentFactory america = new AmericaFactory();

            world = new AnimalWorld(america);
            world.RunFoodChain();

            // Wait for user input

            Console.ReadKey();
        }