Mechanism of Vptr and Vtable in C++

Just went through this link virtual table and _vptr

It says that the workflow will be like ..

  1. base_ptr->base_vptr—-> to check the access of virtual function in base class.

  2. base_ptr->derived_vptr->virtual_function()—> to call/invoke the virtual function.

Hence the derived class virtual function is called.. Hope you find it helpful.

Leave a Comment