Ejemplo n.º 1
0
        static void Main()
        {
            Creator[] creators = new Creator[2];
            creators[0] = new ConcreteCreatorA();
            creators[1] = new ConcreteCreatorB();

            foreach (Creator creator in creators)
            {
                Product product = creator.FactoryMethod();
                Console.WriteLine("Created {0}",
                  product.GetType().Name);
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Entry point into console application.
 /// </summary>
 static void Main()
 {
     // An array of creators
     Creator[] creators = new Creator[2];
     creators[0] = new ConcreteCreatorA();
     creators[1] = new ConcreteCreatorB();
     // Iterate over creators and create products
     foreach (Creator creator in creators)
     {
     Product product = creator.FactoryMethod();
     Console.WriteLine("Created {0}",
     product.GetType().Name);
     }
     // Wait for user
     Console.ReadKey();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // An array of creators
            Creator[] creators = new Creator[2];

            creators[0] = new ConcreteCreatorA();
            creators[1] = new ConcreteCreatorB();

            // Iterate over creators and create products
            foreach (Creator creator in creators)
            {
                Product product = creator.FactoryMethod();
                Console.WriteLine("Created {0}",
                                  product.GetType().Name);
            }

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            /*rmay begin*/
            Creator c = new ConcreteCreatorA();
            Product produc = c.FactoryMethod();
            var producB = new ConcreteCreatorB().FactoryMethod();
            /*rmay end*/
            // An array of creators
            Creator[] creators = new Creator[2];

            creators[0] = new ConcreteCreatorA();
            creators[1] = new ConcreteCreatorB();

            // Iterate over creators and create products
            foreach (Creator creator in creators)
            {
                Product product = creator.FactoryMethod();
                //Console.WriteLine("Created {0}",                     product.GetType().Name);
            }

            int x = 0;

            Creator creador = new ConcreteCreatorB();

            Product producto = creador.FactoryMethod();
            producto.GetNombre();

            creador = new ConcreteCreatorA();

            producto = creador.FactoryMethod();
            producto.GetNombre();

            creador = new ConcreteCreatorC();

            producto = creador.FactoryMethod();
            producto.GetNombre();

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