我想实现一个抽象类“原始”定义为带有Method的抽象类,后面定义了具有指向Class的指针的数据类型。去
class Primitive
{
virtual bool intersect(Ray& ray, float* thit, Intersection* in) = 0;
virtual bool intersectP(Ray& ray) = 0;
virtual void getBRDF(LocalGeo& local, BRDF* brdf) = 0;
};
我的问题是原始包含方法交叉使用,其定义为
class Intersection
{
LocalGeo localGeo;
Primitive* primitive;
};
路口有交集型链接到原始。所以,我不能编译这个,因为编译器给出了一个错误,即Intersection没有被定义,因为它在Primitive定义之后。
的问题归结为...
class A
{
void afunc(B *b);
};
class B
{
A *a;
}
是否有办法以这种方式来定义类?我试图谷歌,但我不知道什么谷歌。
感谢
正向声明'Intersection'。 – lapk 2013-04-27 22:51:37