/** * abstractfactory.h * Implemented by Blueprint Technologies, Inc. */ #ifndef _abstractfactory_h #define _abstractfactory_h /** * declares an interface for a type of product object. */ class AbstractProductA { }; /** * defines a product object to be created by the * corresponding concrete factory. */ class ProductA1: public AbstractProductA { }; /** * defines a product object to be created by the * corresponding concrete factory. */ class ProductA2: public AbstractProductA { }; /** * declares an interface for a type of product object. */ class AbstractProductB { }; /** * defines a product object to be created by the * corresponding concrete factory. */ class ProductB1: public AbstractProductB { }; /** * defines a product object to be created by the * corresponding concrete factory. */ class ProductB2: public AbstractProductB { }; /** * declares an interface for operations that create * abstract product objects. */ class AbstractFactory { public: virtual AbstractProductA* createProductA() = 0; virtual AbstractProductB* createProductB() = 0; }; /** * implements the operations to create concrete * product objects. */ class ConcreteFactory1: public AbstractFactory { public: virtual AbstractProductA* createProductA() { return new ProductA1(); }; virtual AbstractProductB* createProductB() { return new ProductB1(); }; }; /** * implements the operations to create concrete * product objects. */ class ConcreteFactory2: public AbstractFactory { public: virtual AbstractProductA* createProductA() { return new ProductA2(); }; virtual AbstractProductB* createProductB() { return new ProductB2(); }; }; #endif