【发布时间】:2011-02-04 03:33:26
【问题描述】:
好的,我有两个类:图像和场景。现在在 Image 头文件中,我定义了三个私有变量:xcoord、ycoord 和 index(以及它们各自的公共 getter 方法)。
我有另一个名为 Scene 的类。 Scene 不是 Image 的子类。场景有两个成员变量:int maximum 和 Image **images。现在在 Scene 中,我有一些方法试图访问 Image 类的成员变量。例如:
int beginX =this->images[i].getXcoord;
int beginY =this->images[i].getYcoord;
但是,我收到以下错误:
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*’
在我的 scene.cpp 文件中,我包含了 scene.h,其中包含 image.h,所以我很确定所有内容都已正确链接。我的问题是否显而易见,或者我必须提供更多信息吗?
【问题讨论】:
标签: c++