On 23 February 2011 10:54, Klaus Rudolph wrote: > > What I am searching for is the following: > > class A > { > void AnyFunc(); > } > > int main() > { > A a1; > A a2; > > ...anyPointerDefinition ptr1; > ...anyPointerDefinition ptr2; > > ptr1= &(a1.Func); > ptr2= &(a2.Func); > > //call the pointers as functions > ptr1(); > ptr2(); > } > > where ptr1 and ptr2 must contain the ptr to the method and the ptr to > the object. This extension is available on borland as I know?! > > Any idea? I don't think G++ supports that. You can do it using the TR1 library extensions: #include <tr1/functional> struct A { int f(); }; int main() { using std::tr1::function; using std::tr1::bind; A a; function<int()> f = bind(&A::f, a); return f(); } The same functionality is available in the Boost library too.