Give the definition of a template class called HeterogeneousPair that is like the class template Pair discussed in the section Syntax for Class Templates, except that with HeterogeneousPair the first...



Give the definition of a template class called HeterogeneousPair that


is like the class template Pair discussed in the section “Syntax for Class


Templates,” except that with HeterogeneousPair the first and second


positions may store values of different types. Use two type parameters


T1 and T2; all items in the first position will be of type T1, and all items


in the second position will be of type T2. The single mutator function


setElement in the template class Pair should be replaced by two


mutator functions called setFirst and setSecond in the template class


HeterogeneousPair. Similarly, the single accessor function getElement


in the template class Pair should be replaced by two accessor functions


called getFirst and getSecond in the template class HeterogeneousPair.

Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here