The Templated Pair class

Once you have successfully tested the simple Pair class, you must modify it to be a templated class. This is mainly a matter of adding template <class T> at the appropriate locations and changing types from int to T. In particular, the implementation of the overloaded "==" operator changes to:

     bool Pair<T>::operator== (const Pair<T>& rhs) const {
        /* Code here to see if first==first and second==second,
         * OR first==second and second==first

You will also need to change the structure of Pair.h and Pair.cpp:

To test the templated class, comment out the declarations of pair1, pair2, pair3, and pair4 on lines 8 – 11, uncomment the declarations on lines 13 – 16, and compile:

      g++ -Wall -ansi lab11.cpp Pair.cpp -o lab11