Example #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();
        }
Example #2
0
 public Client(AbstractFactory factory)
 {
     ProductA productA = factory.CreateProductA();
     ProductB productB = factory.CreateProductB();
 }