Hacker News new | past | comments | ask | show | jobs | submit login

You're thinking of a const pointer or reference. Of course if the data the pointer is pointing at changes, if you dereference it you get something else. But notice: the pointer, ie. the page number of your book, or the offset in your array, did indeed remain const. It is just the contents of the book/array that changed.

So, a const value cannot be mutated locally or globally. So if you make something const and expose it, it cannot be changed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: