## 22.6 Setting Behavior Using Template Arguments (cont.)

- Use template arguments:

  >     template<typename T, typename CMP>
  >     class OrderedCollection
  >     {
  >     public:
  >        typedef Iterator<T> iterator;
  >        void add(T value);
  >        iterator begin();
  >        iterator end();
  >     private:
  >        List<T> data;
  >        CMP comparator;
  >     };

prev |top |next