Esempio n. 1
0
        static void Main(string[] args)
        {
            Creater creater = null;
            Product product = null;

            creater = new ConcreteCreater();
            product = creater.FactoryMethod();
            creater.AnOperation();
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Creater[] creaters = new Creater[2];

            creaters[0] = new CreaterA();
            creaters[1] = new CreaterB();

            foreach (var provider in creaters)
            {
                AbstractProduct product = provider.CreateProduct();
                Console.WriteLine("Product is: " + product.GetType().Name);
            }

            Console.ReadLine();
        }