Thanks for the reply..
Originally Posted by
grumpy
2) calling set_unexpected() in the constructor of a base class. This works, since base class constructors are guaranteed to be called before derived class constructors.
Is this how the above step is to be done:
Code:
void f() //Unexpected exception handler
{
cout<<"Unexpected handler"<<endl;
}
class A //Base class that performs set_unexpected
{
unexpected_handler h;
public:
A()
{
h=set_unexpected(f);
}
~A()
{
set_unexpected(h);
}
};
class B:public A //Derived class that throws unexpected_exception
{
public:
B() throw ()
{
throw 1;
}
};
B b;
int main()
{
}
It doesn't show the message: "Unexpected handler". I get an exception which is unhandled : System.Runtime.InteropServices.SEHException.