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...

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

1. In C#, a variable must be assigned a value before it can be used on the right side of an assignment statement. 2. The C# compiler will compile code that attempts to use an unassigned variable. 3. You can declare multiple variables of different data types in one program statement. 4. If you need to store numbers and perform mathematical operations on them, you have to use a numeric data type.

Computer Science & Information Technology

The DatePart function always returns a number.

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

Computer Science & Information Technology

Describe the steps you should take to ensure that column labels display on each printed page of a large dataset.

What will be an ideal response?

Computer Science & Information Technology

You can press _____ to display the Hyperlink dialog box.?

A. ?CTRL+B B. ?CTRL+H C. ?CTRL+I D. ?CTRL+K

Computer Science & Information Technology