View Single Post
Old Feb 10th, 2008, 4:55 PM   #10
Lakrids
Newbie
 
Join Date: Dec 2007
Posts: 28
Rep Power: 0 Lakrids is on a distinguished road
Re: Pointer to member function

Quote:
It is impossible to do what you want to do by using C++.
Lol thanks! But a fellow programmer just pointed me out that in fact, it is possible. And he wrote me code which works. The idea is to make a static wrapper member function which will call the non-static one. It also involves passing a pointer to the object, which is then converted into a void*, and in the member function itself, reconverted into the class's type, which will then be passed to the function as the first argument, the implicit "this". This way the wanted action is performed on the object in question, and always gives accurate results.

Remember, this is C++. Nothing is impossible.
Lakrids is offline   Reply With Quote