#include using std::cout; using std::endl; //Class for a pair of values of type T: template class Pair { public: Pair( ); Pair(T firstValue, T secondValue); void setFirst(T newValue); void setSecond(T newValue); T getFirst( ) const; T getSecond( ) const; private: T first; T second; }; template Pair::Pair(T firstValue, T secondValue) { first = firstValue; second = secondValue; } template void Pair::setFirst(T newValue) { first = newValue; } template T Pair::getFirst( ) const { return first; } int main( ) { Pair p('A', 'B'); cout << "First is " << p.getFirst( ) << endl; p.setFirst('Z'); cout << "First changed to " << p.getFirst( ) << endl; return 0; }