我收到此错误:
'&':对绑定成员函数表达式的非法操作
在这一行:
this->schedule(schedule_selector(TimerMethod), 0.01);
我不知道为什么,因为没有"&"代码中的字符。
答案 0 :(得分:0)
在ClassName::methodName
micro。
schedule_selector
的方法名称
假设Xyz是Layer
的孩子的任何类的名称。
class Xyz : public Layer {
public:
virtual bool init();
void TimerMethod(float dt) {
}
}
以这种方式在Layer init()
方法中进行调度:
bool Xyz::init(){
if(!Layer::init())
return false;
this->schedule(schedule_selector(Xyz::TimerMethod), 0.01);
return true;
}