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

1. In C++, a virtual destructor is invoked whenever a virtual constructor was used to create the object.
2. Redefining and overriding are exactly the same thing.
3. A class template can be derived from a non-template class.
4. A class template cannot be derived from a class template.
5. A non-template class can be derived from a class template instantiation.


1. False
The keyword virtual cannot be applied to a constructor. There is a virtual constructor idiom. (see p291, Cline, Lomow, and Girou, C++ FAQs, AWL ISBN 0-201-30983-1) There are very necessary virtual destructors.
>>Same story. Not in text. Have to cut
2. False
If you put virtual in the base class for a function name whose signature is the same down the inheritance chain, then you are overriding. If you leave off the virtual keyword here you are redefining. A difference arises only when you access the member function through a pointer or a reference to a base class and the object referred to is of a derived class type. Otherwise, the behavior is the same.
3. True
4. False
The example provided in the text in Display 16.8 is an example that the statement is false.
5. True
This is ordinary inheritance.

Computer Science & Information Technology

You might also like to view...

A block:

a. Must contain exactly three statements. b. Cannot contain declarations. c. Is a compound statement. d. Is represented by placing a semicolon (;) where a statement would normally be.

Computer Science & Information Technology

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

1. True/False: The two’s complement representation of +6710 in 8-bits is 10000112. 2. True/False: External documentation consists of comments within a program that explain the code, step by step. 3. True/False: When a program is written by identifying tasks and subtasks and then writing modules to deal with each task, this is known as modular programming.

Computer Science & Information Technology

The Recommend Charts feature is located on the INSERT tab on the Ribbon

Indicate whether the statement is true or false

Computer Science & Information Technology

The ________ page is the first page that viewers will see when they visit a website.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology