#include <iostream>
using namespace std;

class A
{
private:
    int m_x;
public:
    A(int x) : m_x(x)
    {
        if (x <=0)
            throw 1;
        
    }
};

class B : public A
{
public;
    //B(int x)
    //  : A(x)
    //    {}
    B(int x) try: A(x)
    {
         // do initialization
    }
    catch (...)
    {
        cout << "Catch in B constructor" << "\n";
        //throw; // re-throw를 해준것처럼 작동한다.
    }
};

int main()
{
    try
    {
        B b(0);
    }
    catch (...)
    {
        cout << "Catch in main()" << "\n"; // constructor 에서 1번, main에서 1번 . throw를 주석처리 했지만 있는것처럼 작동
    }
    
    return 0;
}