Ok I've found the problem. I wasn't properly defining the pointer-to-member function type. I left it the same as the non-member function pointer. I think the correct code is:
Code:
typedef void (NetworkInterface::*InternalPacketHandler)(unsigned char* data, unsigned int dataLength, SystemAddress sourceSystem);
Instead of:
Code:
typedef void (InternalPacketHandler)(unsigned char* data, unsigned int dataLength, SystemAddress sourceSystem);
And in the class:
Code:
private:
InternalPacketHandler internalPacketHandlers[256];
In the constructor:
Code:
internalPacketHandlers[i] = &NetworkInterface::defaultPacketHandler;
However, this brings me to another problem:
The typedef of InternalPacketHandler requires that the class NetworkInterface has been defined before, while the class NetworkInterface requires that InternalPacketHandler has been defined before. How do I solve this?
EDIT:
just saw your post, Salem. Shouldn't it be "internalPacketHandlers[i] = &NetworkInterface::defaultPacketHandler;" instead of "internalPacketHandlers[ i ] = NetworkInterface::defaultPacketHandler;"?