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
Related Posts:
- What are the differences between a pointer variable and a reference variable in C++?
- What does `*&` in a function declaration mean?
- initial value of reference to non-const must be an lvalue
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- C++ pass an array by reference
- Is C++ Array passed by reference or by pointer?
- Linker Error C++ “undefined reference ” [duplicate]
- Return array in a function
- What does “dereferencing” a pointer mean?
- Regular cast vs. static_cast vs. dynamic_cast
- What is a smart pointer and when should I use one?
- What does “dereferencing” a pointer mean?
- What is a char*?
- What exactly is nullptr?
- Are the C++ & and * operators inverses in all contexts?
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- How to fix a “invalid operands to binary expression” error?
- What is a dangling pointer?
- (->) arrow operator and (.) dot operator , class pointer
- Pass a vector by reference C++
- What is uintptr_t data type
- What is the difference between const int*, const int * const, and int const *?
- how does the ampersand(&) sign work in c++?
- C++ – No matching member function for call to ‘push_back’
- What is uintptr_t data type
- What does int & mean
- What is the difference between const int*, const int * const, and int const *?
- Difference between const reference and normal parameter
- Pointer to incomplete class type is not allowed
- Passing a 2D array to a C++ function
- Is the practice of returning a C++ reference variable evil?
- Can’t resolve Error: indirection requires pointer operand (‘int’ invalid)
- When should I use the new keyword in C++?
- How to create a dynamically-allocated array of const objects, but have values assigned to them?
- How to access the contents of a vector from a pointer to the vector in C++?
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- What does int & mean
- C++: Expression must have a constant value when declaring array inside function
- Sorting Linked List C++ with pointers
- Delete 2D array C++
- Is the sizeof(some pointer) always equal to four?
- C++ Expression must have pointer-to-object type
- C++ strings and pointers
- Typedef function pointer?
- How to initialize a vector of pointers
- What is the use of intptr_t?
- Error: No instance of constructor matches the argument list
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- C++ – Assigning null to a std::string
- Using C-string gives Warning: “Address of stack memory associated with local variable returned”
- Why use pointers?
- C++ Return value, reference, const reference
- What’s the difference between * and & in C?
- How to create a vector of class objects in C++?
- Function stoi not declared
- C++ Array of pointers: delete or delete []?
- Why should I use a pointer rather than the object itself?
- Function stoi not declared
- C++ correct way to return pointer to array from function
- Warning: comparison of distinct pointer types
- Is null reference possible?
- Initializing pointers in C++
- Why can’t I make a vector of references?
- Difference between function arguments declared with & and * in C++
- Difference between the int * i and int** i
- set head to NULL (‘NULL’ : undeclared identifier)
- What is a `char*`?
- clearing a vector of pointers [duplicate]
- C++ Swapping Pointers
- Meaning of *& and **& in C++
- Array of Linked Lists C++
- Differences between unique_ptr and shared_ptr
- Making my own toString() method on c++ struct
- Struct Constructor in C++?
- What is meant with “const” at end of function declaration? [duplicate]
- error: lvalue required as unary & operand
- What is use of c_str function In c++
- Is there a decent wait function in C++?
- What does T&& (double ampersand) mean in C++11?
- Should I learn C before learning C++?
- Comparison with string literal results in unspecified behaviour?
- c++: No instance of overloaded function
- C++ error: Undefined symbols for architecture x86_64
- Visual Studio debugger error: Unable to start program Specified file cannot be found
- Printing the correct number of decimal points with cout
- Reading getline from cin into a stringstream (C++)
- C++ int float casting
- QltAW.png
- std::wstring VS std::string
- gcc: undefined reference to
- Call to non-static member function without an object argument compiler error
- How can I assign an array from an initializer list?
- I get this error: “glibc detected”
- got “cannot appear in a constant-expression” when using template
- C++ ostream and ofstream conversions
- C++ discards qualifiers
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- C++ : Exception occurred in script: basic_string::_S_construct NULL not valid
- Multiple inputs on one line
- Getting the error floating point exception: 8