Explain terminate() and unexpected() function - C++

Explain terminate() and unexpected() function.

- The terminate() is a library function which by default aborts the program.
- It is called whenever the exception handling mechanism cannot find a handler for a thrown exception.
- The 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().
Describe Exception handling concept with an example
Describe Exception handling concept with an example - Exceptions are certain disastrous error conditions that occur during the execution of a program.....
Rethrowing exceptions with an example - C++
Illustrate Rethrowing exceptions with an example - Rethrowing an expression from within an exception handler can be done by calling throw....
What is a base class?
What is a base class? - Inheritance is one of the important features of OOP which allows us to make hierarchical classifications of classes....
Post your comment