Virtual Method Table

Noun · Development

Definitions

  1. A per-class lookup table of function pointers used by compilers (particularly C++ and C#) to implement dynamic dispatch of virtual methods. Each object with virtual methods contains a hidden pointer (vptr) to its class's vtable, and a virtual method call becomes an indexed load from this table followed by an indirect function call.

    In plain English: A hidden table the compiler creates for each class, listing which function to call for each overridable method, so the right version runs automatically.

    Example: "The vtable lookup adds one pointer indirection per virtual call — that's why game engines avoid deep inheritance hierarchies in hot paths."

Related Terms