|
|
|
vtables
Posted by taubz [send private reply] at June 23, 2001, 12:38:17 PM
What are virtual tables? I've come accross them a few times, but I'm not sure what they are. Are they specific to COM, or is it a C++ thing, or something else?
- taubz
Posted by Psion [send private reply] at June 23, 2001, 02:28:36 PM
I believe they are how you emulate C++ in a C program. You create a struct that has a function pointer for each method that the equivalent class would have. Obviously, you are then limited as far as overloading and such, but often it allows you to compile C++ code in C.
Posted by pramod [send private reply] at July 02, 2001, 02:56:35 AM
actually they are used by the compiler to implement virtual functions. what happens is that the compiler maintains some kind of a secret pointer to all the sub class virtual functions and calls the right one when you call a virtual function from a base class pointer/reference. i think almost all oo languages with polymorphism use them.
Posted by taubz [send private reply] at July 02, 2001, 06:10:43 PM
Hrm.... I'm not sure I understood... but cool...
- taubz
Register as a new user | ||||||