Sollicitatievraag bij Safe Software

Difference between a reference and a pointer in C++

Antwoorden op sollicitatievragen

Anoniem

10 dec 2017

A reference is an _alias_ for another variable. As such, it has certain inherent characteristics: 1. it always points to an object. 2. It can not be altered to point to somewhere else once it has been bound. 3. There is not reference arithmetic. Most often, a reference is implemented by the compiler as a pointer, but it is not required to implement it in that manner.

Anoniem

23 sep 2014

They are essentially the same thing except a reference cant be recast