How to cast a pointer to a member function into a void*?
-
I got the code as follows: class A{ int f(); //f defined elsewhere } void main() { void* p; p = A::f; //it gives a compiler error //how to cast f into p? //My friend did that in asm, however i want an easier way. } Thanks in advance
-
I got the code as follows: class A{ int f(); //f defined elsewhere } void main() { void* p; p = A::f; //it gives a compiler error //how to cast f into p? //My friend did that in asm, however i want an easier way. } Thanks in advance
-
I got the code as follows: class A{ int f(); //f defined elsewhere } void main() { void* p; p = A::f; //it gives a compiler error //how to cast f into p? //My friend did that in asm, however i want an easier way. } Thanks in advance
void* p = (void*)(A::f); C++ compilers are very strict, they want to make absolutly sure you know what you are doing (this is a good thing). If you need to do this you are probubly doing some thing wrong. I recommend that you read up on vetual base classes. Trust in the code Luke. Yea right!