回调函数怎样调用啊???
在.ccp中定义一个回调:
void __stdcall Notify(int _iID,int _iState);
int ClassXXX::Test(){ //该如何调用Notify呢?直接调?还是再定义一个调用的函数之类的?}
#include <iostream>using namespace std;typedef int (__stdcall *Func) (int,int);int Calc(int x, int y, Func func){ int sum; sum = func(x, y); return sum;}int _stdcall Add(int a, int b){ return a + b;}int _stdcall Sub(int a, int b){ return a - b;}int main(){ int a, b; cout<<"Please input the first integer:"<<endl; cin>>a; cout<<"Please input the second integer:"<<endl; cin>>b; int m, n; m = Calc(a, b, Add); n = Calc(a, b ,Sub); cout<<a<<"+"<<b<<"="<<m<<endl; cout<<a<<"-"<<b<<"="<<n<<endl; system("pause"); return 0;}