コード例 #1
0
        static void Main(string[] args)
        {
            ContinentFactory africa = new AfricaFactory();
            AnimalWorld      world  = new AnimalWorld(africa);

            world.RunFoodChain();

            ContinentFactory america = new AmericaFactory();

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

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: karen281196/Patronesdise-o
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public static void Main()
        {
            // Create and run the African animal world
            ContinentFactory africa = new AfricaFactory();
            AnimalWorld      world  = new AnimalWorld(africa);

            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();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: buddhika85/Design-Patterns
        static void Main(string[] args)
        {
            AnimalWorld_Client world     = null;
            IContinentFactory  continent = null;
            string             result    = null;

            continent = new AmericaFactory();
            world     = new AnimalWorld_Client(continent);
            result    = world.RunFoodChain();
            Console.WriteLine(result);                      // Wolf eats Bison

            continent = new AfricaFactory();
            world     = new AnimalWorld_Client(continent);
            result    = world.RunFoodChain();
            Console.WriteLine(result);                      // Lion eats Wildebeest

            Console.ReadLine();
        }