-
What is the output of this program?
#include <iostream>
#include <exception>
using namespace std;
void terminatorFunction()
{
cout << "terminate" << endl;
}
void (*old_terminate)() = set_terminate(terminatorFunction);
class BotchClass
{
public:
class Fruits {};
void f()
{
cout << "First" << endl;
throw Fruits();
}
~BotchClass() noexcept(false)
{
throw 'U';
}
};
int main()
{
try
{
BotchClass obj;
obj.f();
}
catch(...)
{
cout << "inside catch(...) block" << endl;
}
}
-
- Aborted
- terminate
- First
- inside catch(...) block
- None of these
Correct Option: A
This program uses set_terminate as it is having an uncaught exception.