I have templated class "Factory". The proto-type of factory is something as follows:
template <class T>
class Factory
{
public:
Factory();
~Factory();
//few more functions & data-members
private:
//few more functions & data-members
};
In the main() I make multiple types of Factories as in --
int main()
{
typedef Factory<int> IntFactory ;
IntFactory A = IntFactory();
typedef Factory<float> FloatFactory ;
FloatFactory B = FloatFactory();
//Complex is some user defined class
typedef Factory<Complex> ComplexFactory ;
ComplexFactory C = ComplexFactory();
//Point3D is a user defined class
typedef Factory<Point3D> Point3DFactory ;
Point3DFactory D = Point3DFactory();
//I may have several such initializations.
}
The question is how do I make an array of objects A,B,C,D incase I want to iterate through them?
FactoryBase, the best you could do would be an array ofFactoryBase*.