//this is a template class to store pairs of objects //we will then define operations that can be performed on pairs #include #include using namespace std; template class genPair { private: Type a; Type b; public: genPair(Type first, Type second) { a=first; b=second; } Type getFirst(){return a;} Type getSecond(){return b;} void setFirst(Type newVal){a = newVal;} void setSecond(Type newVal){b = newVal;} //displays genPair in form (a, b) //uses Type's stream insertion (<<) operator void displayPair() { cout<< "("<a + right.a; second = this->b+right.b; genPair sum(first, second); return sum; } void swap(); }; template void genPair::swap() { Type temp = a; a = b; b = temp; } int main() { genPair p1(1, 2); genPair p2(3, 4); p2.swap(); genPair p3 = p1+p2; cout<< "The sum of "; p1.displayPair(); cout<<" and "; p2.displayPair(); cout<<" is "; p3.displayPair(); genPair name("Bob", "Smith"); cout< space(" ", " "); name=name+space; cout<