template<class MessageHandlerClass>
class TimerApp
{
//friend class TimerApp;
typedef void (MessageHandlerClass::*HandlerMethod)();
public:
static void AddTimer(int interval,MessageHandlerClass *handler);
private:
static int interval_;
static HandlerMethod handler_method_; //回调函数指针
static MessageHandlerClass* handler_; //调用对象
static void OnTimer();
};
template<class MessageHandlerClass> int TimerApp<MessageHandlerClass>::interval_ = 0;
template<class MessageHandlerClass> MessageHandlerClass * TimerApp<MessageHandlerClass>::handler_ = 0;
请问handler_method_如何在类外初始化
我尝试template<class MessageHandlerClass> HandlerMethod SubTimerApp<MessageHandlerClass>::handler_method_ = 0;
报错:error: ‘HandlerMethod’ does not name a type
ä½ å¥½ï¼æé®çæ¯å ¶ä¸æ个å½æ°æéåéå¦ä½å¨ç±»å¤å®ä¹ï¼è°¢è°¢