c++ – Reference to non-static member function must be called
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.
Try this:
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 this
:
(this->*func)(<argument>);
http://www.codeguru.com/cpp/cpp/article.php/c17401/C-Tutorial-PointertoMember-Function.htm
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?
c++ – Reference to non-static member function must be called
Related posts on c++ :
- c++ – error: lvalue required as unary & operand
- c++ – No matching member function for call to ‘push_back’ error
- c++ – Comparison with string literal results in unspecified behaviour?
- c++ – glm rotate usage in Opengl
- c++ – Error: Expression must have integral or unscoped enum type
- c++ – Argument list for class template is missing
- c++ – qualified-id in declaration before ( token
- Is it possible to decompile a C++ executable file
- c++ – Pointer to incomplete class type is not allowed