Consider the class definition:

```
class IntPair{ int first; int second;public:
IntPair(int firstValue, int secondValue);// prefix
operator++ here
// postfix operator ++ here
int getFirst( ) const;
int getSecond( ) const;
```
a) Give declarations for prefix and postfix versions of operator++
b) Give definitions for prefix and postfix versions of operator++

a) declarations:
```
const IntPair operator++( ); //Prefix versionconst
IntPair operator++(int); //Postfix version
```
b) definitions.
```
//prefix version
const IntPair IntPair::operator++( )
{
first++;
second++; return IntPair(first, second);}

//postfix versionconst IntPair IntPair::operator++(int
ignoreMe) { int temp1 = first;
int temp2 = second;
first++;
second++;
return IntPair(temp1, temp2);
```

Computer Science & Information Technology

You might also like to view...

When resigning from a job, the ________ approach is better for this type of letter

A) passive B) concrete C) indirect D) active

Computer Science & Information Technology

In the hexadecimal color value #CCAA99, the CC refers to the __________ color component?

a. red b. blue c. green d. yellow

Computer Science & Information Technology