Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c++ Create a class template Pair that houses 2 items of datatype T. Whatever datatype stored needs to implement the operators. There should be
in c++
Create a class template Pair that houses 2 items of datatype T. Whatever datatype stored needs to implement the operators. There should be two private data attributes called item 1 and item2. There should be the following public methods. A2 argument constructor. A method getMax that returns the larger of the two stored items. A method getMin that returns the smaller of the two stored items. A method setitems that takes in two constant items by reference and sets item 1 and item2 to them. A method getItem1 that returns item1. A method getItem2 that returns item2. Make a appropriate methods const so they don't alter item1 or item2 if not needed. You should have a Pair.h and Pair.cpp file. Create a pairTest.cpp file with a main() that creates two pairs, one that houses ints an one that houses strings. Test all the methods for these two Pairs in your main and display the resultsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started