| Sample uses of the application operators - slightly more realistic. | Lecture 5 - slide 35 : 39 Program 6 |
#include <iostream>
#include <string>
#include "point.h"
int main(){
using namespace std;
Point p(1,2),
q(3,4);
try{
cout << "p(1): " << p(1) << endl; // 1
cout << "p(2): " << p(2) << endl; // 2
cout << "q(1): " << q(1) << endl; // 3
cout << "q(2): " << q(2) << endl; // 4
cout << "p(3): " << p(3) << endl; // Throws IndexProblem exception.
}
catch (IndexProblem){
cout << "Recovering from indexing problem" << endl;
}
}