/// <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();
    }
Beispiel #2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public static void Main()
        {
            #region rmay demo
            /******rmay begin******/
            AbstractFactory af1 = new ConcreteFactory1();
            var productoA = af1.CreateProductA();
            Console.WriteLine("Created {0}", productoA.GetType().Name);
            AbstractProductB productoB = af1.CreateProductB();
            Console.WriteLine("Created {0}", productoB.GetType().Name);

            AbstractFactory af2 = new ConcreteFactory2();
            productoA = af2.CreateProductA();
            productoB = af2.CreateProductB();

            ProductA1 pA1 = new ConcreteFactory1().CreateProductA() as ProductA1;

            /******rmay end******/

            #endregion

            // 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();
        }