Reputation: 1
typedef void (classname::*funptr)(int);
void classname::func(int p)
{
...
}
void classname::someotherfunc()
{
........
funptr ptr;
ptr= &(classname::func); // this is error line
...........
}
It gives me the following error:
error C2276: '&' : illegal operation on bound member function expression.
Next I tried
ptr= classname::func;
which gives this error:
error C3867: 'FaceBinUI::progress_update': function call missing argument list; use '&FaceBinUI::progress_update' to create a pointer to member
Please suggest some solution for this problem.
Upvotes: 0
Views: 1419
Reputation: 76529
The compiler is telling you exactly what you need to do:
ptr= &classname::func;
So just lose the parentheses.
Upvotes: 2