Пример #1
0
        static void Main(string[] args)
        {
            IFactory factoryFamilyA  = new FactoryFamilyA();
            ProductA productAFamilyA = factoryFamilyA.getProductAInstance();
            ProductB productBFamilyA = factoryFamilyA.getProductBInstance();

            productAFamilyA.showMessage();
            productBFamilyA.showMessage();

            IFactory factoryFamilyB  = new FactoryFamilyB();
            ProductA productAFamilyB = factoryFamilyB.getProductAInstance();
            ProductB productBFamilyB = factoryFamilyB.getProductBInstance();

            productAFamilyB.showMessage();
            productBFamilyB.showMessage();

            Console.Read();
        }
Пример #2
0
 public Client(AbstractFactory factory)
 {
     ProductA productA = factory.CreateProductA();
     ProductB productB = factory.CreateProductB();
 }