c++ - How create a function pointer to point a member function? -


this question has answer here:

code:

struct {     void* f(void *)     {      } }; int main() {     void * (*fp)(void *);     fp = &a::f; } 

compile:

|12|error: cannot convert 'void* (a::*)(void*)' 'void* (*)(void*)' in assignment| 

i have tried many ways, failed... how that?

for regular member pointer, you'll need declare type it's member of on pointer type;

int main() {     void * (a::*fp)(void *);     fp = &a::f; } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -