C++ register callback from server -


i've prototype of callback as:

typedef void (*update)(int id,...); typedef void (*destroy)(int id,...); typedef void (*create)(int id, update* _update, destroy* _destroy); 

and create callbacks function:

void updatecb(int id,...){/*add id collection*/} void destroycb(int id,...){/*remove id collection*/} void createcb(int id,update* _update, destroy* _destroy) {      //register callbacks      *_update = updatecb;       *_destroy = destroycb; } 

when register callbacks compiler give me error:

error: cannot convert 'classname::updatecb' type 'void (classname::)(int,...)' type 'update {aka void (*)(int..)}'

how can valid register callbacks?

you trying use member functions impossible in case. happens because every member function ( if not static ) carries hidden pointer class instance called this. need use global functions or static member functions.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -