Explain why when you enter 0 and throw a Base exception, it is not caught by the Derived1 block?
int main() { int number = 0; for (;;) { try { cin >> number; cout << number << " "; switch (number) { case 0: throw Base(); case 1: throw Derived1(); case 2: throw Derived2(); } } catch (Derived1 /*exception*/) { cout << "Exception of derived class" << endl; } catch (Base /*exception*/) { cout << "Exception of Base class" << endl; } } return 0; }
catch (Derived1)catchBasetype exceptions? - AnT