Yes, you can catch such an exception using the-try-block function:
class B
{
A _a;
public:
~B() try {
}
catch (const std::exception& e)
{
}
};
However, you cannot do much with such an exception. The standard states that you cannot access the elements of a non-static element or the base classes of an object B.
In addition, you cannot disable the exception. Unlike other functions, the exception will be thrown implicitly as soon as the handler of the try-block function of the destructor (or constructor) finishes execution.
, .