아래 코드에서 특별한 처리 순서가 어떻게 발생하는지 설명해주십시오. 이C++ Exceptional handling queries
로 평가 했는가
#include "stdafx.h"
#include <iostream>
using namespace std;
class E {
public:
const char* error;
E(const char* arg): error(arg) {}
};
class B {
public:
B() {};
~B(){cout<<"~B() called"<<endl;}
};
class D: public B {
public:
D();
~D() { cout<<"~D() called"<<endl; }
};
D::D() try :B(){
throw E("Exception in D");
} catch(E&e)
{
cout<<"Handler of function try block of D()"<<e.error<<endl;
};
int main()
{
try {
D val;
}catch(...) {}
}
설명해주세요. 무엇에 관해서 설명해주세요. –