private void Factory() { AbstractFactory factory = FactoryProducer.GetFactory(false); IShape shape1 = factory.GetShape("RECTANGLE"); shape1.Draw(); IShape shape2 = factory.GetShape("SQUARE"); shape2.Draw(); AbstractFactory roundedFactory = FactoryProducer.GetFactory(true); IShape shape3 = roundedFactory.GetShape("RECTANGLE"); shape3.Draw(); IShape shape4 = roundedFactory.GetShape("SQUARE"); shape4.Draw(); }
// Constructor public Client(AbstractFactory factory) { _abstractProductB = factory.CreateProductB(); _abstractProductA = factory.CreateProductA(); }
public Client(AbstractFactory factory) { this.productA = factory.CreateProductA(); this.productB = factory.CreateProductB(); }