struct A{ int func(){return 0;} int val; }; struct B{ int func(){return 0;} int val; }; struct C{ static int A::*pval_A, B::*pval_B;//成员变量的指针(偏移量) static int (A::*pfunc_A)(), (B::*pfunc_B)(); }; int A::* C::pval_A= &A::val; int B::* C::pval_B= &B::val; int (A::*C::pfunc_A)()= &A::func; int (B::*C::pfunc_B)()= &B::func; 顺便实现个max函数,比较对象的数据成员中值的大小,不用重载operator< () template<typename _Object_Type, typename _Member_Type> inline _Object_Type& test_max( _Object_Type& a, _Object_Type& b, _Member_Type _Object_Type::* member ){ return a.*member > b.*member? a: b; } 用的时候也不用写模板参数列表 ... A ta1,ta2; test_max(ta1, ta2, &A::val); ...