Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago