-
What is the output of this program?
#include <iostream>
#include <exception>
using namespace std;
struct NewException : public exception
{
const char * what () const throw ()
{
return "Interview Mania";
}
};
int main()
{
try
{
throw NewException();
}
catch(NewException& e)
{
cout << "Exception Caught..." << std::endl;
cout << e.what() << std::endl;
}
catch(std::exception& e)
{
}
}
-
- Compilation Error
- Exception Caught...
- Interview Mania
- Runtime Error
- Exception Caught...
Interview Mania
Correct Option: E
We are defining the user-defined exception in this program.