Bloomberg LP Interview Question
Software Engineer / DevelopersVirtual function: function meant to be overridden in the derived class.
Each class maitains a virtual function table containing the address of the virtual functions. When the object of a class is made a virtual pointer is created that points to the virtual table. So when a function is called the vpointer looks up the vtable which contains the virtual function address and calls the correct function
address of virtual function &, you will get the offset of the function in the vtbl, and compiler will use that to access the virtual function
- asuran October 13, 2008