Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    Sample uses of the application operators - Funny and artificial.Lecture 5 - slide 35 : 39
Program 3
#include <iostream>
#include <string>
#include "point.h"

int main(){
  using namespace std;

  Point p(1,2),
        q(3,4);
  double d, e;

  d = p(5);                     // Use the application operator on p, pass 5 as the int parameter.
                                // Pretends that p is a function.
                                // 1 + 2 + 2*5
  cout << "d: " << d << endl;   // 13

  e = p(q);                     // Another overload of the application operator.
                                // Applies p on q
                                // Pretends, in a similar way, that p is a function.
                                // 1*3 + 2*4 
  cout << "e: " << e << endl;   // 11
  
}