c++ – Reference to non-static member function must be called
The problem is that
buttonClickedEvent is a member function and you need a pointer to member in order to invoke it.
void (MyClass::*func)(int); func = &MyClass::buttonClickedEvent;
And then when you invoke it, you need an object of type
MyClass to do so, for example
You may want to have a look at https://isocpp.org/wiki/faq/pointers-to-members#fnptr-vs-memfnptr-types, especially [33.1] Is the type of pointer-to-member-function different from pointer-to-function?