Похожие чаты

Base *base = new Derived();

//Derived implements interface Base
base->opr(); //Base::opr() is virtual


How is the VTable of Derived accessed, on call to opr(), if the pointer is to Base? Or does the compiler have a means of directly accessing the object the pointer points to?

I know that every object of a class has a pointer to the Vtable for that class(as long as virtual functions are invovled). I just want to know whether the compiler calls an interface not visible to the programmer or something, to get the correct VTable

1 ответов

11 просмотров

https://pabloariasal.github.io/2017/06/10/understanding-virtual-tables/

Похожие вопросы

Обсуждают сегодня

Карта сайта