Q:

What are VTABLE and VPTR in c++?

0

What are VTABLE and VPTR?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Remark: vptr and vtbl are Implementations defined the C++ standard does not even talk about them.

Vtable: The virtual table is a lookup table of functions used to resolve function calls in a dynamic/late binding manner. The compiler builds this vTable at compile time. The virtual table sometimes goes by other names, such as “vtable”, “virtual function table”, “virtual method table”, or “dispatch table”.

vptr:When you create an object of a class that contains the virtual function, then the compiler added a pointer to this object as a hidden member. This hidden pointer is called virtual table pointer, vpointer, or VPTR. This vptr stores the address of the vtable.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now