Solved

Show How to Overload the Operators << and >> to Create

Question 25

Essay

Show how to overload the operators << and >> to create stream output for this class.
Make these functions friends of the class Pair.The expected form of a pair is (2,3)for both input and output.To make this problem manageable,you should only provide to accept and discard the parentheses and comma,but you should not check that these particular characters were typed.Output should be the expected form.
class IntPair
{
\quad int first;
\quad int second;
\quad public:
\quad\quad IntPair(int firstValue,int secondValue);
\quad\quad int getFirst( )const;
\quad\quad int getSecond( )const;
};

Correct Answer:

verifed

Verified

#include <iostream>
using namespac...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents