Pointers to functions

Some compilers are clever in their matching of function pointer arguments to the declaration of the function, and will not complain in the following case:

typedef void (*wxFunction) (wxObject&, wxCommandEvent&);
...
void mycallback(wxButton& button, wxCommandEvent& event);
...
wxButton button(parent, &mycallback, label, 100, 200);
Since wxButton is derived from wxObject, the function mycallback is a subtype of wxFunction. In Microsoft C++, and most compilers with a high warning level set, the function is not an exact match, and the compiler complains. The solution is to place a cast in front of the function address, thus:

wxButton button(parent, (wxFunction)&mycallback, label, 100, 200);