I am creating a class which is callback based. I need to give the client a freedom to invoke the callback that he defines. For example, I have a class Base:
class Base
{
...
public:
virtual void OnMsgReceived(const char *msg, char *&response);
virtual void OnMsgReceived(const char *msg, string &response);
};
The client MUST implement either one, but not 2. How do I know which one he has implemented so that when I handle the callback, I call the right one?
I know I can't do it during the construction instantiation of the object, but once the object is instantiated, is there any way for me check which one of these virtual functions has been implemented? Thanks.