【发布时间】:2016-09-19 16:06:44
【问题描述】:
我有以下代码:
class Check {
public:
static bool IsTesting() {
#ifdef __MQL4__
return IsTesting(); // _______ @fixme: Here the infinite recursion occurs
#else
return (MQL5InfoInteger(MQL5_TESTER));
#endif
}
};
void OnStart() {
Print("Starting...");
if (Check::IsTesting()) { // _______ a first call to a class-method
Print("This is a test.");
}
}
我在其中创建了要调用的类方法,但是代码进入无限递归,因为类方法的名称与系统内置(全局)函数相同(IsTesting() ),而不是调用前者,而是递归调用后者 (it-self)。
如何说明我想调用全局函数,而不是本地类方法,而不更改方法名称?
【问题讨论】:
标签: class oop recursion namespaces mql4