Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            AbstractFactory factory1 = new ConcreteFactory1();
            Client          client1  = new Client(factory1);

            client1.Run();

            // Abstract factory #2
            AbstractFactory factory2 = new ConcreteFactory2();
            Client          client2  = new Client(factory2);

            client2.Run();

            // Wait for user input
            Console.ReadKey();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public static void Main()
        {
            // Abstract factory #1
            AbstractFactory factory1 = new ConcreteFactory1();
            Client          client1  = new Client(factory1);

            client1.Run();

            // Abstract factory #2
            AbstractFactory factory2 = new ConcreteFactory2();
            Client          client2  = new Client(factory2);

            client2.Run();

            // Wait for user input
            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // Abstract Factory 1
            AbstractFactory factory1 = new ConcreteFactory1();
            Client          client1  = new Client(factory1);

            client1.Run();

            // Abstract Factory 2
            AbstractFactory factory2 = new ConcreteFactory2();
            Client          client2  = new Client(factory2);

            client2.Run();

            // Output:
            // ConcreteFactory1 created ProductA1
            // ConcreteFactory1 created ProductB1
            // ProductB1 interacts with ProductA1
            // ConcreteFactory2 created ProductA2
            // ConcreteFactory2 created ProductB2
            // ProductB2 interacts with ProductA2
        }