I'm running into a basic array issue that I can't seem to get my head around.
I have a class "StaticDisplayLayer" and the constructor takes 2 parameters - an int and a pointer to an array of 3 unsigned short ints:
//constructor definition:
StaticDisplayLayer(int type, unsigned short *displayColor[3]);
//constructor code:
StaticDisplayLayer::StaticDisplayLayer(int type, unsigned short *dColor[3]) : DisplayLayer(type)
{
displayColor = dColor;
}
I'm trying to create an instance of that class using the following:
unsigned short layerColor[3] = {(unsigned short)255,(unsigned short)255,(unsigned short)255};
StaticDisplayLayer myLayer(1, &layerColor);
My understanding is that &layerColor is a pointer to the layerColor array but the compiler is giving me the following error:
no matching function for call to `StaticDisplayLayer::StaticDisplayLayer(int, short unsigned int (*)[3])'
Candidates are:
StaticDisplayLayer::StaticDisplayLayer(const StaticDisplayLayer&)
StaticDisplayLayer::StaticDisplayLayer(GLenum, short unsigned int**)
I know the second candidate is the one I'm trying to use but obviously I'm not understanding the concept of pointer to an array. If someone could shed some light on how to call that constructor and/or any resources that explain this I'd appreciate it - so far my searches online haven't really turned up much.