-
What is the output of this program?
#include <iostream>
#include <exception>
using namespace std;
class NewException: public exception
{
virtual const char* what() const throw()
{
return "New Exception occurred...";
}
} NewExcep;
int main ()
{
try
{
throw NewExcep;
}
catch (exception& e)
{
cout << e.what() << endl;
}
return 0;
}
-
- Compilation Error
- Runtime Error
- Garbage value
- New Exception...
- None of these
Correct Option: D
This is a standard exception handler used in the class.