Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'                application-operator-overload/vers2/prog.cc - Sample uses of the application operators - slightly more realistic.Lecture 6 - slide 21 : 40
Program 6

// Sample uses of the operator()(int).

#include <iostream>
#include <string>
#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;
  }
  
}