It is desirable to develop your programs incrementally. Code a little, test a little. If you do this with virtual functions, you get into trouble. Discuss the problem and the (very simple) solution.

What will be an ideal response?


If you fail to define functions that has the virtual keyword, even if there are no derived classes, even if there is only one function with the virtual keyword, in fact you don’t even have to call the function! you will get an error message at compile time to the effect that there is an undefined reference in a virtual table for the class. The fix is easy. For virtual void functions put an empty pair of braces for the function body. For virtual value returning functions, use a return something; inside braces. Then there will be no problem with the tables.

Computer Science & Information Technology

You might also like to view...

If you need to redirect the output from a command, what symbol should you use?

A. | B. * C. > D. ?

Computer Science & Information Technology

What are some characteristics of a strong password? What are some strategies for creating strong passwords that you can easily remember?

What will be an ideal response?

Computer Science & Information Technology

Windows XP was the last Windows operating system built on the Windows 95 kernel.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

How can you check latency using the ping utility?

What will be an ideal response?

Computer Science & Information Technology