'method': an event handler method must return the same type as the source 'method'
You defined an event handler method that did not return the same type as the source event method. To fix this error, give the event handler method the same return type as that of the source event method. For example, in the code below, change the return type of handler1
or event1
to the same type (such as void or another integral type) where indicated by comments.
The following sample generates C3712:
[event_source(native)] class CEventSrc { public: __event void event1(); }; [event_receiver(native)] class CEventRec { public: int handler1() { // Try the following instead // void handler1() { return 0; } void HookEvents(CEventSrc* pSrc) { __hook(CEventSrc::event1, pSrc, CEventRec::handler1); // C3712 } void UnhookEvents(CEventSrc* pSrc) { __unhook(CEventSrc::event1, pSrc, CEventRec::handler1); // C3712 } }; void main() { }