Wednesday, September 17, 2014

Virtual table or vTable



The virtual table is a look-up table of functions used to resolve function calls in a dynamic/late binding manner. The virtual table sometimes called by other names, such as “vtable”, “virtual function table”, or “virtual method table”.


Every class that uses virtual functions is given its own virtual table. This table is simply a static array that the compiler sets up at compile time. A virtual table contains one entry for each virtual function that can be called by objects of the class. Each entry in this table is simply a function pointer that points to the most-derived function accessible by that class.


The compiler also adds a hidden pointer to the base class, which we will call *__vptr. *__vptr is set (automatically) when a class instance is created so that it points to the virtual table for that class. Unlike the *this pointer, which is actually a function parameter used by the compiler to resolve self-references, *__vptr is a real pointer. 




Ref:Learncpp.com

String Table

A string table is a Windows resource that contains a list of IDs, values, and captions for all the strings of your application. For exa...