Thanks for your reply, but i forgot to mention something that i haven't got any control on the function Function(void *aFunction , void *callingObject=null) as it came with a header file of a library and i've got to use it as is, besides when i try to use &this->FuctionNeededPointer it gives the following error '&' : illegal operation on bound member function expression
kikocharana
Posts
-
Member function pointer -
Member function pointerHello , ive got the following member function pointer problem noting that all my search result on the net wasn't useful at all. class MyClass { Anotherclass MyObject; void Function1(); void FunctionNeededPointer(Float*,int,int); }; void MyClass::Function1() { //Here i need to pass a pointer of a function to the //following function belonging to MyObject //void Anotherclass::Function(void *aFunction,void // *callingObject=NULL) //so i tried this and didn't work void (MyClass::*pToFunction)(float*,int,int) = &MyClass::FunctionNeededPointer; MyObject.Function((void*)pToFunction); //oops error: cannot convert from void(__thiscall // Myclass::*)(float*,int,int) to void* //So had to make that function static and worked but //it ended up that every thing in MyClass was converted //to static which is not a nice solution at all //so i'm wondering if someone could help with this //problem }