问题描述
我有一个名为foo的类,带有一个名为test()的函数
如何从test()获取函数指针
我已经尝试过
#include <iostream>
class Foo
{
public:
void test()
{
std::cout << "test" << std::endl;
}
};
int main()
{
Foo foo;
void(*runtest)() = foo.test;
return 0;
}
但是当我用vs2019构建它时
Main.cpp(16,6): error C2059: Syntax error: '='
在错误列表下,我们也
a pointer to a bound function may only be used to call the function
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)