Is the following legal? Why or why not?

Consider the class definition:
```
class IntPair { int first; int second; public: IntPair(int firstValue, int secondValue); const IntPair operator++( ); //Prefix version const IntPair operator++(int); //Postfix version
int getFirst( ) const;
int getSecond( ) const;
};
```

```
IntPair a(1,2);
(a++)++;
```

No.

The return value from both versions of the overloaded operator ++ is by constant value, prohibiting calling a mutator on the return value of a++.

Computer Science & Information Technology

You might also like to view...

To create a PivotChart, you must first create its associated ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Podcast is an acronym for Programming On Demand.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology