Q:

In particular, we can bind a reference to const to a nonconst object, a literal, or a more general expression

0

In particular, we can bind a reference to const to a nonconst object, a literal, or a more general expression.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

int i = 42;
const int &r1 = i; // we can bind a const int& to a plain int object
const int &r2 = 42; // ok: r1 is a reference to const
const int &r3 = r1 * 2; // ok: r3 is a reference to const
int &r4 = r * 2; // error: r4 is a plain, non const reference

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now