I know, many post asking about this, been reading about 10 post with long answers but, every post seems different case and needs different implementation.
so, what did i do wrong here?
#include <iostream>
using namespace std;
class Foo {
public:
void callbackFunc(void (*funcParam1)());
void funcA();
};
void Foo::callbackFunc(void (*funcParam1)()) {
funcParam1();
}
void Foo::funcA() { cout << "func A OK.." << endl; }
void aa(){
int x =0;
}
Foo bar;
int main() { bar.callbackFunc(bar.funcA); }
this example throws error: invalid use of non-static member function ‘void Foo::funcA()’
in the main()
especially in the callbackFunc
parameter.
i want to use it in arduino later.