|
|
|
|
|
by mhaberl
2151 days ago
|
|
I used the terminology that the OP used to be more clear. Pointer or reference in this context is not so significant as is that 'const' is marking the reference (OP used "pointer") as a constant, and not the value that is referring to. Point the OP was getting at:
'const' gives you an immutable reference to a mutable value because it is a modifier for the reference and not the value. Yes, the article you linked was unambiguous, but for another question :) As i said, a lot of langugaes (I don't know any that behaves differently) uses the const/final modifiers in this way. In my experience with people that are just learning how to code, it is a more efficient to point out what is the 'const' modifier making a constant of, than pointing out what it does not do, because the latter sometimes sends a message that the 'const' is useless as it 'does not do anything'. |
|