Possible Duplicate:
throwing exceptions out of a destructor
In C++ we should never throw an exception in the destructor . Does this code works as intended ?
struct a
{
~a( ) { }
};
struct b : public a
{
~b( )
{
throw 1;
};
};
bool c( )
{
a* d=new b;
try
{
delete d;
}
catch( int e )
{
return e;
}
return false;
}