Wednesday, May 2, 2012

Difference between const ref and const pointer, c++

I'd like to know what's the difference between const ref and const pointer in c++.
When I declare on something to be const ref, can I change it's VALUE?
or the const goes on the object?
Because I know that const pointer means you cannot change the POINTER but you can change the VALUE it points to.



for example:



const char& a; // ?
const char* a; // pointer is const




No comments:

Post a Comment