Some code
typedef void (*EventHandler) (EventObject* sender, EventArgs* args, void* closure);
class Control
{
void AddHandler(int eventId, EventHandler handler, void* data)
}
class SubControl
{
static void mousemove_cb(EventObject* sender, MouseEventArgs* calldata, void* closure);
}
The error
error C2664: 'Control::AddHandler' : cannot convert parameter 2 from 'void (__cdecl *)(EventObject *,MouseEventArgs *,void *)' to 'EventHandler'
Here is the line that produce the error:
control.AddHandler(MouseMoveEvent, mousemove_cb, 0);
Description
The problem is that MouseEventArgs is a sub-class of EventArgs ! So, is there a way to have an automatic casting and register my method with the precise 'Event args'?