Monday, March 24, 2008

Little Sugar : C++

In C++ have you imagined what would happen if the destructor of your class throws an exception . For starters , the object would not get destroyed properly . Actually in reality the control would go back to the callee from the current point directly.

Alright , now think what would happen if the destructor got called as a part of some exception handling code and this destructor threw an exception .

Since the active callee is calling the destructor due to some raised exception .
it would result in the terminate() function getting called and though would terminate the program immediately

No comments: