Here are several function members of a class. Tell whether each may be used as an l- value, only, an r-value only or both. B is a class that has mutators.

a)```
//declarations of these appear together in the
//definition of class A
int& A::f( ){ /* */}
const int& A::f( )const{ /* */}
```
b)```
const int& A::f( ){ /* */}
```
c)```
const B A::f( ){ /* */}
```
d)```
B A::f( ){ /* */}
```

In a) the first will be used if f() is used as an l-value, and the second
implementation will be used if f() is used as an r-value.
In b) f() can be used as an r-value only.
In c) f() can be used as an r-value only and no mutators can be called on the return value.
In d) f() can be used as an r-value only, but mutators can be called on the return
value

Computer Science & Information Technology

You might also like to view...

If most of the records in a table have the same value for one specific field, use the ________ property to increase the efficiency of data entry

A) Relationship B) Format C) Default Value D) Field Size

Computer Science & Information Technology

A group of related data points

A) Data label B) Data marker C) Data series

Computer Science & Information Technology