Friday, March 2, 2007

Virtual Functions..

Something I found interesting about the virtual functions..

VTABLE : It contains addresses of virtual functions. The compiler creates a VTABLE for each class that contains virtual functions and for classes that are derived from it. The VTABLE contains the addresses in the order in which virtual functions are defined within the class.

VPTR : It is the address of the VTABLE stored in the object.

Upcasting : It means storing the address of the derived class object in the base class pointer.

I hope it was useful in knowing more about virtual functions....

No comments: