D
Dat Chu
I want to write an class that hide away the function pointer
callbacks. That is:
Normally i create this function:
void errorCallback(char * err_msg)
then I call
registerErrorCallback(&errorCallback)
Then when there is an error in this third party module, my
errorCallback function will get called.
However, I would like to make this as a clean OO implementation. I
face with a problem, how can I pass a function to
registerErrorCallback that when call will make some change the state
of my object?
I got stuck with some singleton-like implementation but I am not sure
if this is a good idea.
Dat Chu
callbacks. That is:
Normally i create this function:
void errorCallback(char * err_msg)
then I call
registerErrorCallback(&errorCallback)
Then when there is an error in this third party module, my
errorCallback function will get called.
However, I would like to make this as a clean OO implementation. I
face with a problem, how can I pass a function to
registerErrorCallback that when call will make some change the state
of my object?
I got stuck with some singleton-like implementation but I am not sure
if this is a good idea.
Dat Chu