Virtual Method Table
Created on 2020-08-19T21:59:38.796727
- Each class of object has a list of function pointers called the "vtable."
- Each method the object understands has an index within this table.
- To call a virtual method you find the index of that method, then look at the virtual table for the object, and call the procedure at this location.
C++ "virtual" methods use this technique.
It is compatible with objects added at runtime and across libraries.
It involves long indirect jumps which can take up to ~10% of a program's runtime.