当我在 conn 方法中调用静态方法ClassA :: it()时,出现编译错误。
#ifndef CLASSA
#define CLASSA
#include "ClassB.h"
namespace name {
class ClassA
{
public:
static ClassA& it()
{
static ClassA c;
return c;
}
[...]
};
}
#endif
-
#ifndef CLASSB
#define CLASSB
#include "ClassA.h"
namespace name {
class ClassB
{
public:
static Handle conn()
{
return getHandle(ClassA::it().str());
}
};
}
#endif
我收到编译器错误,说明在方法 conn()中没有声明ClassA。如何解决此错误?