subject
Engineering, 15.02.2020 01:52 msalecora

C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Whatever datatype stored needs to implement the < and > operators.
There should be two private data attributes called item1 and item2.
There should be the following public methods.

A 2 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 item1 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.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 16:10
The force on a cutting tool are 2600n vertically downward and 2100 horizontal. determine the resultant force acting on the tool and the angle at which it acts.
Answers: 1
question
Engineering, 04.07.2019 18:10
Fluids at rest possess no flow energy. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:20
Have a greater impact on maintenance productivity than any other support group. (clo5) a)-the top management b)-inventory and purchasing c)-sub-contracting d)-cmms
Answers: 2
question
Engineering, 04.07.2019 19:10
How to increase the thermal officiency of an ideal simple rankino cycle? among these methods, which one is the best and why?
Answers: 2
You know the right answer?
C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Wh...
Questions
question
English, 21.10.2020 17:01
question
Mathematics, 21.10.2020 17:01
question
Mathematics, 21.10.2020 17:01
question
Mathematics, 21.10.2020 17:01
question
History, 21.10.2020 17:01
question
English, 21.10.2020 17:01
Questions on the website: 13722363