typedef void (* HW_HANDLE)(int);
class Switch
{
private:
HW_HANDLE handle;
public:
Switch(const HW_HANDLE h = 0 ) { handle=h; }
void Exec() { handle(1); }
};
void ShowLog(int v)
{
printf("this is %d/n",v);
}
class HdApi
{
public:
HW_HANDLE setConcreteSwitch;
HdApi() { setConcreteSwitch=ShowLog; }
};
HdApi aHdapi;
int _tmain(int argc, _TCHAR* argv[])
{
Switch aSwitch(aHdapi.setConcreteSwitch);
aSwitch.Exec();
return 0;
}
=======================================================
vs2008上正常运行,但是在vc6.0上编译会失败???