2d array of object pointers
I have a 2d array of object pointers. It looks like this.
Code:
someObject *arr[8][8];
This arr array is a member of another class. I tried initializing it in a double for loop by pointing all of the positions to a default "someObject".
Code:
SomeObject *s = new SomeObject();
for(int i=0; i < 8; i++){
for (int j=0; j < 8; j++){
arr[i][j] = SomeObject;
}
}
The code compiled without error but doesn't run. It doesn't give any error messages either. I guess some memory is being overwritten. Am I doing this wrong? I want arr to be a 2d array of SomeObject pointers so that I can do things like arr[x][y]->func().