// Notes: I never allocate this class on stack
// NetworkMessage::getOpcodes() returns a DWORD between 0x0 - 0xFFFFFF
class Protocol{
private:
int (*m_HandlerMap[0x1000000])(NetworkMessage &msg);
int m_LoginHandler(NetworkMessage &msg);
public:
void RegisterHandlers(){ m_HandlerMap[0] = &m_LoginHandler; return;}
int ParseMessage(NetworkMessage &msg){ if(m_HandlerMap[msg.getOpcodes()] != NULL) return m_HandlerMap[msg.getOpcodes()](msg);}
};
My problem is that unless I make m_LoginHandler static I get compile errors. Is it possible to create a pointer to a non-static member function from within the other class functions?