错误求助:xxx的左侧必须指向类/结构/联合
isarc 2007-08-24 11:10:05 大家好:
调试程序有如下错误:
a.h
#include<b.h>
#include<structA.h>
.........
private:
a* b;
int iX;
strcutA iStrcut;
==============
b.h
#include <structA.h>
int func() const;//return iInt;
StructA funcstruct()const;//return iStruct;
iInt;
iStrcut;
............
a.cpp里面:
a::a(){b = b::construct;}
a::a'sfunc()
{
ix = a->func();//出现xxx的左侧必须指向类/结构/联合这样的错误。
iStrcut = a->funcstruct();
int vTemp = iStruct.iIntValue;//出现。。。的左侧必须有类/结构/联合类型错误
}
我搜索了一下,把以前的前向声明改成了include文件,b类会在a类之后才被执行构造,但是我会让a'sfunc()等待一会再执行,这样它就可以有数值了。函数是public,为什么会有这个错误?