#include <iostream>
#include <functional>
using namespace std;
class test;
typedef std::function<void (test*)> Func;
class test{
public:
Func get(void){
return std::bind(&test::private_func,std::placeholders::_1);
}
private:
void private_func(void){ cout << "private_func is working..."<<endl; }
};
int main(void){
test t;
Func f = t.get();
f(&t);
return 0;
}
输出结果:
$ ./a.out
private_func is working...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)