Consider the following C++ code: See image.
Because a virtual method call is resolved at run time, calling f1 will be slower than calling f2, and an object of class C1 will be larger than an object of class C2. But by how much?
Your task is to devise and conduct an experiment that measures the extra overhead (in both time and space) of the virtual function mechanism in C++, then report on your findings. Imagine that your goal is to provide advice for programmers considering whether or not to use the virtual mechanism for a critical section of code. Ideally, you should offer guidelines on which programmers could base their decisions without having to undertake their own experiments.
Your report should include at least the following elements:
In preparing and writing your report you will need to survey relevant material that others have written. Of course, you must make sure that you acknowledge any material that you use or reference in your report, including diagrams, tables, and the like. Use an established convention, such as the Author-Date ("Harvard") system, for citations and bibliography.
Your report should consist of a typed document of around 2500 words that conforms to accepted norms for style and presentation of written work. You will be assessed on your insight into the relevant issues, the clarity with which you have presented your ideas, and your attention to writing style and presentation details.