3
4

1 回答 1

3

print_num is a non-static member function, which means that it has an implicit first argument of type A*. You can, for instance, pass that by using a lambda:

void run() { 
    auto myself = this;
    setFunction( [myself] (int i) { myself->print_num (i); } ); 
} 

or use bind, see here

c++ Trouble casting overloaded function: <unresolved overloaded function type>

于 2012-10-11T06:49:37.770 回答