C++ overloaded method pointer [duplicate]

(void (A::*)()) &A::f
(void (A::*)(int)) &A::f

function pointers and member function pointers have this feature – the overload can be resolved by to what the result was assigned or cast.

If the functions are static, then you should treat them as ordinary functions:

(void (*)()) &A::f;
(void (*)(int)) &A::f;

or even

(void (*)()) A::f;
(void (*)(int)) A::f;

Leave a Comment

tech