#if 1
#include <iostream>
using namespace std;
class CEventQuery;
typedef bool(*CommonFuncPoint)(void);
typedef bool (CEventQuery::*ClassFuncPoint)(int);
bool CommonFunc(void)
{
cout << "CallBackFunc Common Function Call!" << endl;
return true;
}
bool callback(void)
{
cout << "回调函数!" << endl;
return true;
}
class CEventQuery
{
public:
CEventQuery(CommonFuncPoint eventFunc):m_Event(eventFunc)
{
}
~CEventQuery() {}
void Query(void)
{
m_Event();
}
bool DoSomething(int iValue)
{
cout << "Class Function DoSomething Parament : " << iValue << endl;
return true;
}
private:
CommonFuncPoint m_Event;
};
int main(void)
{
CEventQuery tEventQuery(callback);
tEventQuery.Query();
ClassFuncPoint ClassFunc1 = &CEventQuery::DoSomething;
(tEventQuery.*ClassFunc1)(10);
tEventQuery.DoSomething(20);
system("pause");
return 0;
}
|