不解释,就让你看得蛋疼。
#include <iostream>
using namespace std;

class T {
typedef void (T::*Tptr)(void);
    Tptr p;
public:
    void a() { cout << "a" << endl; }
    void b() { cout << "b" << endl; }
    void call(Tptr _p) {
        p = _p;
        (this->*p)();
    }
};

int main() {
    T t1;
    t1.call(&T::a);
    t1.call(&T::b);
    return 0;
}




欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php