示例#1
0
        // Use this for initialization
        void Start()
        {
            ContinentFactory africa = new AfricaFactory();
            AnimalWorld      world  = new AnimalWorld(africa);

            world.RunFoodChain();

            ContinentFactory america = new AmericaFactory();

            world = new AnimalWorld(america);
            world.RunFoodChain();
        }
示例#2
0
        public static void Main(string[] args)
        {
            AnimalWorld animalWorldEurope = new AnimalWorld(new EuropeFactory());

            animalWorldEurope.RunFoodChain();

            Console.ReadLine();

            AnimalWorld animalWorldAfrica = new AnimalWorld(new AfricaFactory());

            animalWorldAfrica.RunFoodChain();

            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            // Create and run the African animal world
            ContinentFactory africa      = new AfricaFactory();
            AnimalWorld      animalWorld = new AnimalWorld(africa);

            animalWorld.RunFoodChain();

            // Create and run the American animal world
            ContinentFactory america = new AmericaFactory();

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

            // Wait for user input
            Console.ReadKey();
        }