template <typename T> class CFooImpl { protected: void callfoo() { T* t = static_cast<T*>(this); t->foo(); } void callfoo(void(T::* f)()) { // how to call f ?? } void callfoo(T& r, void(T::* f)()) { (r.*f)(); } void callfoo(T* p, void(T::* f)()) { (p->*f)(); } }; class CFoo :public CFooImpl<CFoo> { public: void foo() { printf("foo! "); } void test() { auto pf = &CFoo::foo; callfoo(); callfoo(*this, pf); callfoo(this, pf); } }; int main() { CFoo a; a.test(); return 0; }