Class method as function parameter

c++, c++11

Solution

C++ doesn't have bound methods as a language construct. Write:

someFunc(std::bind(&A::Add, instanceA, std::placeholders::_1));

Problem

I'm trying to pass some class method to some function and take "function call missing argument list; use '& ' to create a pointer to member" error. ``` //There is some class class A { int someField; void Add(int someAdd) { someField += someAdd; } } //And function void someFunc(std::function<void(int x)> handler) { //Some code handler(234); } //Class method pass to function void main() { A* instanceA = new A(); someFunc(instanceA->Add); //Error 19 error C3867: 'A::Add': function call missing argument list; use '&A::Add' to create a pointer to member } ``` What's wrong?

Original source