Answer the following questions true (T) or false (F)
1. In a class, functions declared with the virtual keyword need not be defined.
2. The virtual function mechanism binds the “right” function to objects.
1. False
Explanation: There is a table set up by C++ that needs to know where the function definition is located. If you did not supply one, there will be an error message and the compilation will abort. The error message may not be particularly clear. My compiler complains about ‘missing virtual table’. Non-virtual functions can always be declared but no defined, unless you call them, that is). There is an exception to this: pure virtual functions, in which the body of the function is replaced by =0.
2. True
Explanation: The mechanism is to build a table that is filled in partly at compile time and partly at runtime, then it is read at runtime to decide which function to call.
You might also like to view...
The coordination and control process must maintain the traceability between each ____ and the purposes of the generic recommendation it implements.
A. individual work instruction B. group work instruction C. individual task D. group task
If you click Control on the Application bar, point to ____, and then click in Flash Professional, a new window opens showing the SWF file as it plays the animation of the Start scene followed by the animation of the End scene.
A. Play Animation B. Test Movie C. Preview D. View Animation
Which layer of the TCP/IP model performs IP addressing functions?
A. Layer 1 B. Layer 2 C. Layer 3 D. Layer 4
The STL algorithm ____ copies elements from a source range to a destination range.
a. copy b. copy_backward c. copy_forward d. replace