Answer
In 1994 Microsoft published a patent on implementing Virtual Function tables in OOP Programming Languages:

"A virtual function table for a class contains addresses corresponding to the virtual function members associated with that class.

The virtual function table is used at run time to invoke the virtual functions indirectly. Each primary class with a virtual function member has an associated virtual function table. The virtual function table contains the addresses of each virtual function member.

The object data structure for such a class contains a virtual function table pointer (vfptr). When memory for an object is allocated at run time, the virtual function table pointer is initialized with the address of the associated virtual function table. Thus, all objects of the same class type point to the same virtual function table. To implement the invoking of a virtual function, the compiler generates code to access the virtual function member through the virtual function table."


METHOD FOR IMPLEMENTING VIRTUAL FUNCTION TABLES IN A COMPILER FOR AN OBJECT-ORIENTED PROGRAMMING LANGUAGE




Answers and Comments


Saved Stories

Sponsored Categories





100 Common Interview Questions, audio book