Pointers to functions
Posted on 2002-06-10
Hi, I have created an RS232 class, but I want to change where the results are delivered to on the fly.
in the public: I have declared
void MyFunction(BYTE *,int );
void (*pDeliverData)(BYTE *,int );
Then on implementation
pDeliverData = MyFunction;//I get an error:
[C++ Error] rs232Thread.cpp(38): E2235 Member function must be called or its address taken.
So I then tried
pDeliverData = &MyFunction;//I then get the error:
[C++ Error] rs232Thread.cpp(38): E2034 Cannot convert 'void (* (_closure )(unsigned char *,int))(unsigned char *,int)' to 'void (*)(unsigned char *,int)'.
Ideally I want the thread that created the object to be able to assign a new return function.
Ant tips would be great, thanks.