A pointer to an array of object pointers, which point to objects
Hi, say i have got the following class called X. I want to be able to create a pointer to an array of type X pointers, which then be instantiated into objects. I have tried the follwing, but with no success. Any help would be greatly appreciated.
Code:
int NumObjs = 2;
X **Test;
*Test = new X[NumObjs];
for(int ObjNum; ObjNum < NumObjs; ObjNum++)
Test[ObjNum] = new X(/*Whatever*/);
I need to be able to access the objects using the following notation: Test[0]->Member; Thanks.