Question 4
Back to Exercise
Why must catch (const std::out_of_range&) come before catch (const std::exception&)?
- A Alphabetical order
- B Handlers are tried in order and the first match wins; std::exception would catch out_of_range first, making the specific handler unreachable Correct
- C It does not matter
- D Compilers require it
Correct Answer: Option B
Compilers often warn about the unreachable handler.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!