Pergunta de entrevista da empresa Susquehanna International Group

When using a virtual method, how does the machine know to call the derived class's implementation rather than the base class? (under the hood)

Respostas da entrevista

Sigiloso

2 de dez. de 2010

virtual table in memory

1

Sigiloso

29 de jan. de 2011

All objects have an object ID embedded in them. So, the compiler generates code which dynamically binds the object ID to the right derived class's member function.