[LC++]virtual functions

Adriano dos Santos Fernandes adrianosf at uol.com.br
Fri Oct 29 19:36:01 UTC 2004


Paul Gearon wrote:

> If not for the virtual table then a pointer of type base* would always 
> find the base::print() method, even if the object is of type 
> "derived".  Calling a method on an object without a virtual table just 
> goes to some fixed offset from the start of the object to find the 
> method.

Wrong. The method is called as a normal function (resolved by the linker).
A class that don't have virtual functions is as a C struct, it don't 
have "hide" variables.

>
> Regards,
> Paul Gearon
>
Adriano





More information about the tuxCPProgramming mailing list