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
You might also like to view...
Which of the following media types is LEAST likely to be affected by electromagnetic interference?
A. Coaxial B. Fiber C. Wireless B D. HSPA
A ________ card stores authentication data.
magnetic stripe smart Both magnetic stripe and smart Neither magnetic stripe nor smart