What is the difference between a constant pointer and a reference?
Constant pointer as the name implies can not be bound again. Same is the case with the reference.
I wonder in what sort of scenarios would one be preferred over the other. How different is their C++ standard and their implementations?
cheers
There are 3 types of const pointers:
Method #2 above is most similar to a reference.
There are key differences between references and all of the 3 types of const pointers above:
Const pointers can be NULL.
A reference does not have its own address whereas a pointer does.
The address of a reference is the actual object’s address.
A pointer has its own address and it holds as its value the address of the value it points to.
See my answer here for much more differences between references and pointers.