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