// CATCH / THROW / TRY - code to check for unexpected errors

#include <iostream>

using namespace std;

class A {};

class B : public A {};

int main() {

  try {
    throw B();
  }

  catch(A a) {
    // lands here
    cout<<"A type exception"<<endl;
  }

  catch(B b) {
    cout<<"B type exception"<<endl;
  }

  catch(...) {
    cout<<"Any type of exception"<<endl;
  }

return 0;
}

// OUTPUT
//
// Warnings:
// catch_try.cpp(22) : warning C4286: 'class B' : is caught by base class ('class A') on line 17
// catch_try.cpp(17) : warning C4101: 'a' : unreferenced local variable
// catch_try.cpp(22) : warning C4101: 'b' : unreferenced local variable
//
// A type exception
//
// EOF
//
