// Sample uses of the operator()(int). #include #include #include "point.h" int main(){ using namespace std; Point p, q(1), // less confusing if {} initializer r(3,4); // syntax is used here try{ cout << "p(1): " << p(1) << endl; // 0 cout << "p(2): " << p(2) << endl; // 0 cout << "q(1): " << q(1) << endl; // 1 cout << "q(2): " << q(2) << endl; // 0 cout << "r(1): " << r(1) << endl; // 3 cout << "r(2): " << r(2) << endl; // 4 cout << "p(3): " << p(3) << endl; // Throws IndexProblem exception. } catch (IndexProblem){ cout << "Recovering from indexing problem" << endl; } }