function pointers n classes
hi
im trying to write a sorta windows emulator, and i got a class, cWindow, and it has a member function pointer: void (*ProcName)()
however, this function will obviously be unable to use private class members...
wc.ProcName = blah
the compiler wont allow access to members because the function pointed to isnt necessarily a member or freind of the class.
how can i get around this?
well you need to get the index number of the function in the vtable
and i hope this function is a virtual one
otherwise derive the class and override that function
now click here!
and i hope it will help you
good luck!
Arkon
[QSoft Systems]
and i hope this function is a virtual one
otherwise derive the class and override that function
now click here!
and i hope it will help you
good luck!
Arkon
[QSoft Systems]
Borland added this feature to C++ Builder because it was sadly lacking in C++. They added the __closure directive so that you could declare function pointers that were actually methods of a class. A damned good idea that started in Delphi, was added to C++ Builder and will hopefully be added to the C++ standard in the near future. All other methods I have seen so far of calling methods from a function pointer are just clever hacks.
Steve ''Sly'' Williams Code Monkey Krome Studios
Steve ''Sly'' Williams Code Monkey Krome Studios
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement