Answer the following questions true (T) or false (F)
1. A derived class destructor always invokes the base class destructor.
2. The base class destructor must be virtual.
1. true
Explanation: A base class destructor always exists, even if it is the compiler supplied destructor. The derived class destructor should just release resources allocated by some constructor. It does not call any other destructor. the run-time system calls the destructors in the order of the inheritance chain.
2. False
Explanation: There is no requirement that the base class destructor be virtual, but if pointers and allocation are involved, it is wise to do so. It is easy to construct examples where the derived class constructors allocate resources and the corresponding destructors are not called unless the base class destructor is virtual. Many authorities say destructors should always be virtual, but the compiler does not say that.
You might also like to view...
The Convert to Range command that will convert a table of imported date into a range, is located under Table Tools on the DESIGN tab in the ________ group
A) External Table Data B) Properties C) Table Style Options D) Tools
A ________ control should be used when you want to user to select one or more options at the same time
A) TextBox B) CheckBox C) CommandButton D) ListBox