I have a class defined as:
class Obj {
public:
int width, height;
Obj(int w, int h);
}
and I need it to contain a static array like so:
int presc[width][height];
however, I cannot define within the class, so it it possible to create a pointer to a 2D array (and, out of curiosity, 3, 4, and 5D arrays), have that as a member of the class, and intitalize it in the constructor like:
int ar[5][6];
Obj o(5, 6, &ar);
EDIT: The idea here is that every object will have a different width and height, so the array I use to represent that object will be unique to the object, but once that array is defined (preferably in the constructor), it will not change. And the values of width and height for a particular object are known at compile time.
EDIT: The arrays are for collision detection by superimposing the presc
arrays of two objects onto one large array, and seeing where the overlap, declarations like so:
Obj player1(32, 32); //player with a width of 32 px and height of 32 px, presc[32][32]
Obj boss(500, 500); //boss with a width of 500 px and height of 500 px, presc[500][500]