Code Fragment: generic



template <typename Key, typename Comp>
class GenericClass {				// example class
  Comp comp;					// comparator object
  // ...
public:
  void memberFunction(Key p, Key q) {
    if (comp(p, q) > 0) { /* ... */  }		// compare keys using comp
  }
};
// ...
Point2D p, q;					// p and q are points
GenericClass<Point2D, LexCompare> concrete;
concrete.memberFunction(p, q);			// compare p, q using LexCompare
// ...