Ok I have two classes: Image and Scene. Now in the Image header file, I defined three private variables: xcoord, ycoord, and index (as well as their respective public getter methods).
I have another class named Scene. Scene is not a subclass of Image. Scene has two member variables: int maximum and Image **images. Now in Scene, I have some methods that attempt to access the member variables of the Image class. For example:
int beginX =this->images[i].getXcoord;
int beginY =this->images[i].getYcoord;
However, I get the following errors:
error: request for member ‘getXcoord’ in ‘*(((Image**)((const Scene*)this)->Scene::images) + ((Image**)(((long unsigned int)i) * 8ul)))’, which is of non-class type ‘Image*’
scene.cpp:135: error: request for member ‘getYcoord’ in ‘*(((Image**)((const Scene*)this)->Scene::images) + ((Image**)(((long unsigned int)i) * 8ul)))’, which is of non-class type ‘Image*’
In my scene.cpp file, I have included scene.h which includes image.h, so I’m pretty sure everything is properly linked. Is it apparent what my problem is or will I have to provide more information?
You want to call methods so try:
otherwise the compiler is looking for a member variable and not a getter method