[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [LC++]virtual functions



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