Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          templates/functions/point-norms-and-compare/point.h - The Point class template definition - policy parameterized.Lecture 5 - slide 37 : 40
Program 4

// Class Point parameterized with a policy type P in which distances and comparisons are supplied.

template <typename P> class Point {
private: 
  double x, y;

public:
  Point(double, double);
  Point();
  double getx () const;
  double gety () const;

  double distance_to(Point<P>);
  bool less_than(const Point<P>&);
};

template <typename P> std::ostream& operator<<(std::ostream&, const Point<P>&);