// File: tdtest11.cpp // // This file checks that version 11 of // the TwoDimArray class works. // // Version 11 throws exceptions // #include #include "twodim11.h" using namespace std ; int main() { TwoDimArray A(5,5) ; try { // other code A[2][1] = 17 ; // A[9][1] = 29 ; A[3][7] = 9 ; // other code } catch (OutOfBounds& e) { cerr << "Oops! Out of Bounds detected!\n" ; cerr << e.what() << "\n" ; // preparation for exit (e.g., close files) exit(1) ; } }