Question: Illustration 2 : The minimal operation which must be defined for any iterator is that two of them can be compared as: Group of answer

Illustration 2: The minimal operation which must be defined for any iterator is that two of them can be compared as:
Group of answer choices
greater than and less than
greater than only
equal only
equal and not equal
Illustration 2
// class templates
1. #include
2. using namespace std;
3. template
4. class mypair {
5. T a, b;
6. public:
7. mypair (T first, T second)
8.{a=first; b=second; }
9. T getmax ();
10.};
11. template
12. T mypair :: getmax ()
13.{
14. T retval; |
15. retval = a>b? a : b;
16. return retval;
17.}
18. int main (){
19. mypair myobject (100,75) ;
20. cout << myobject.getmax() ;
21. return 0;
22.}//page 25

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!