Possible Duplicate:
why do I need virtual table?
What is a vtable in C++?
So far I know that vtable is a virtual table which has an array of pointers to virtual functions. Is there an article I can read with an example of a practical implementation? (Any walk through will be appreciated.)
43 Answers
V-tables (or virtual tables) are how most C++ implementations do polymorphism. For each concrete implementation of a class, there is a table of function pointers to all the virtual methods. A pointer to this table (called the virtual table) exists as a data member in all the objects. When one calls a virtual method, we lookup the object's v-table and call the appropriate derived class method.
1vTable (virtual table) is an implementation detail of dynamic dispatch (virtual methods).
See C++-Lite-Faq for more details.
11For all it's worth, it is not a standard C++ terminology. It is just an implementation detail used by the implementation to implement virtual functions/dynamic binding
1