How Virtual Functions Work

01 January 1989

New Image

In a previous article (An example of dynamic binding in C++, Journal of Object-Oriented Programming, vol. 1, no. 3), I said that the thing that really allows object-oriented programming in C++ is the notion of a virtual function and gave a complete example of how to use virtual functions. What I did not do was to explain how virtual functions rally work, how they might be implemented, or what they cost. Let's go back now for a closer look at the details.