Practice mode C++

Which statement about C++ references is correct?

Correct answer D. A reference must be initialised when declared and cannot later be made to refer to another object

Explanation

A reference is an alias that is bound once, at initialisation, so an uninitialised reference declaration is ill-formed. Afterwards, writing r = other assigns other's value to the referred-to object; it never rebinds the reference. Pointers, in contrast, can be null and can be repointed. Whether a reference needs storage at all is left to the implementation.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.