`

c++中的函数指针

 
阅读更多

 

class A
{
    public:
        A (){};                             /* constructor */
        void func(){}


}; /* -----  end of class A  ----- */

typedef void (A::*FUNC)(); // define a function pointer type

int main(void){
    A a;
    FUNC p = &A::func;
    (a.*p)(); // must write with this style to call this fuction pointer
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics