VC.NET Natived Event
#include “stdafx.h”
class TestObj { public: __event void Executed();
protected: void OnExecuted() { printf(“Executed “); }
public: void Execute() { __raise Executed(); }
void BindingEvent(){
__hook(&TestObj::Executed,this,&TestObj::OnExecuted);
}
void UnBindingEvent(){
__unhook(&TestObj::Executed,this,&TestObj::OnExecuted);
}
};
int _tmain(int argc, _TCHAR* argv[]) { TestObj obj; obj.BindingEvent(); obj.Execute (); return 0; }