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 difference between a Polyline and a Polygon is that _______
a) A Polyline has a repeating pattern of identical lines and corners b) A Polygon connects its first and last points. c) A Polyline is closed and can be filled with a color. d) None of the above.
A ring is said to be _________ if it satisfies the condition ab = ba for all a, b in R.
A) ?cyclic ? B) ?commutative ? C) ?abelian ? D) ?infinite
____ indicates the number of pixels that a computer uses to display the letters, numbers, graphics, and background on a screen.
A. Screen view B. Ribbon resolution C. Pixel resolution D. Screen resolution
A(n) ________displays as a faded object in a document's background
A) emblem B) insignia C) logo D) watermark