Пример #1
0
        static void Main(string[] args)
        {
            // Get a ProductA
            IProductFactory factoryA = new ProductAFactory();
            var             productA = factoryA.CreateProduct();

            // Get a ProductB
            IProductFactory factoryB = new ProductBFactory();
            var             productB = factoryB.CreateProduct();
        }
        static void Main(string[] args)
        {
            Creator     productAFactory = new ProductAFactory();
            BaseProduct productA        = productAFactory.Create();

            productA.Print();

            Creator     productBFactory = new ProductBFactory();
            BaseProduct productB        = productBFactory.Create();

            productB.Print();

            Console.Read();
        }