The throw a; line will call the copy constructor to create a temporary copy of the a object, which will then be passed to the exception handler by reference. The a object created on the stack in the try block will be destroyed when exiting this block, so its destructor will be called. When exiting the catch block, the temporary copy of the object a will be destroyed, because it will no longer be referenced. That's why the ~A() destructor will be called at this moment.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать