In a project that I'm working on, I need to make a class that contains an array of pointers to other objects of the same class. I'm currently having trouble initializing this array. Example:
class MrClass{
MrClass* otherInstances[];
public:
MrClass(MrClass* x[]){
otherInstances = x;
}
}
This array must be arbitrarily sized, since the number of instanced of the class to be passed is defined at compile time and it must be of pointers because multiple instances of the class must have access to the same objects.