Constructors and Destructors with Exceptions
- When an exception is
automatic objects created within the try block are destroyed.
This process is referred to as unwinding the stack.
- Destructors are called only for fully constructed objects.
In particular, the destructors of fully constructed subobjects of a partially constructed object
are called, but the destructor of the (partially constructed) containing object is not.
- If the constructor of an object within an
array throws an exception then only the destructors of those
array objects that are fully constructed are called.