some library have code like this:
typedef unsigned long(*poFunc)();
poFunc T ;
//...
void setupA(poFunc exFunc)
{
T = exFunc;
}
and I can use it like this:
unsigned long run()
{
return 9929UL;
}
int main()
{
setupA(run);
}
Now I need to group the functions in a class like this:
class A
{
private:
unsigned long run();
public:
void start ();
};
unsigned long A::run()
{
return 9929UL;
}
void A::start ()
{
setupA(&A::run);
}
int main()
{
A _a;
_a.start();
}
and I get this error:
error: cannot convert 'long unsigned int (A::*)()' to 'poFunc {aka long unsigned int (*)()}' for argument '1' to 'void setupA(poFunc)'
I found this issue similar to my problem,but I have no idea how to fix this.
Thanks.