C++ Exception Handling Question:
Download Questions PDF

Explain unexpected() function?

C++ Exception Handling Interview Question
C++ Exception Handling Interview Question

Answer:

unexpected() is called when a function with an exception specification throws an exception of a type that is not listed in the exception specification for the function
A function declaration without a specification like throw(char*) may throw any type of exception, and one with throw() is not allowed to throw exceptions at all.

By default unexpected() calls terminate().

Download C++ Exception Handling Interview Questions And Answers PDF

Previous QuestionNext Question
Explain terminate() function?How to implement exception handling in C++?