Answer the following questions true (T) or false (F)
1. Downcasting causes the slicing problem.
2. In C++, a virtual destructor is invoked whenever a virtual constructor was used to create the object.
1. false
Explanation: A downcast is the conversion of a Base* to a Derived*, where the derivation of Derived from Base is pubic. It requires the dynamic_cast. It is used when the client programmer hopes the Base* points to an object that really is a Derived object. Downcasting is dangerous. For further discussion of this topic see the text on page 649.
2. False
Explanation: 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
You might also like to view...
“Pre-packaged” functions or classes are available in Python ______.
Fill in the blank(s) with the appropriate word(s).
Which sentence demonstrates correct punctuation??
A. ?That station has up to the minute news. B. ?That station has up-to-the-minute news. C. ?That station has up-to-the minute news.