I have Base and Dervided classes. In the Base class I have a typedef for specific function pointer (I think this is function pointer, im not sure):
typedef void (responseHandler)(BaseClass* instance,int resultCode, char* resultString);
And in the same base class I have several function which accepts this typedef:
unsigned sendDescribeCommand(responseHandler* responseHandler, Authenticator* authenticator = NULL);
In my custom derived class from this Base class I have my response handler function, like this:
void continueAfterDESCRIBE(RTSPClient* rtspClient, int resultCode, char* resultString);
How I can use this method as input for sendDescribeCommand
? I tried this: DerivedClass->sendDescribeCommand(DerivedCLass->continueAfterDescribe, MyAuth)
, but this did not build with error: "error C3867: 'DerivedClass::continueAfterDESCRIBE': non-standard syntax; use '&' to create a pointer to member"
I also tried to use std::bind
:
auto responseCallback = std::bind(&DerivedClass::continueAfterDESCRIBE, DerivedClassInstance); DerivedClass->sendDescribeCommand(responseCallback, ourAuthenticator);
It also give me an error: no suitable conversion from std::bind to my response handler.
I know there is a way to make my method static, but Im curious if there is another way?
Aucun commentaire:
Enregistrer un commentaire