How to cast a function pointer in C++?
Posted on 2008-10-03
I have a struct that contains as one of its members a function pointer. The message pump has an array of these structs and loops through it each time a message is received in a TCP port, executing the handler function if there's a listener for it. It looks like this:
unsigned long msgID;
Problem is, OAtm is a base class from which different vendor classes are derived. So, when one of the derived classes registers one of its listeners, how do I cast it from a void(OAtm::*)(void) pointer to a void(Derived::*)(void)?