class test
{
private://私有成员类外不能够直接访问
int number;
public://共有成员类外能够直接访问
float socre;
public:
int rp()
{
return number;
}
void setnum(int a)
{
number=a;
}
int _cdecl class_search(void *handle, bend_search_rr *rr);
}; int _cdecl test::class_search (void *handle, bend_search_rr *rr)
{
cout<<"我被调用了"<<endl;
return 0;
}
.....
test tt;
q->bend_search=tt.class_search ;编译错误信息如下
error C2440: '=' : cannot convert from 'int (__cdecl test::*)(void *,bend_search_rr *)' to 'int (__cdecl *)(void *,bend_search_rr *)'
There is no context in which this conversion is possible而不赋值类中函数 直接定义到 主程序中 则不报错
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货