Difficulty: Easy
Correct Answer: The program will print the output Int .
Explanation:
Introduction / Context:
With overloads for short, int, and float, a character literal is passed. C++ applies standard conversion sequences and ranks them to choose the best overload. The destructor message will not appear because the allocated object is never deleted.
Given Data / Assumptions:
Concept / Approach:
Integral promotions promote types narrower than int to int (or unsigned int). char is promoted to int as part of the integral promotions. A promotion to int is a better conversion sequence than a conversion to short (which is not a promotion) or to float (a floating conversion). Therefore, the (int) constructor is selected and prints "Int".
Step-by-Step Solution:
Verification / Alternative check:
Cast to (short)'B' to force "Short"; cast to 66.0f to see "Float".
Why Other Options Are Wrong:
Common Pitfalls:
Assuming char selects the char overload (which does not exist here) or that short is preferred for small integers over int.
Final Answer:
The program will print the output Int .
Discussion & Comments