I'm a beginner to C++ and I have a question that I want to make sure...I've done pretty of searching online.
Let say I have a class call A and it has a function called Afunction. The function looks like:
// this is pseudocode
void Afunction (const A& a)
{
a.something = a.something +1;
}
My understanding is we have an "pointer-like" thing called 'a' and it's an alias to whatever we pass in. Here we only make sure the alias itself is const, but no guarantee that the value to which it points at won't be changed. In fact, I'm changing it..and I don't get no error.
So my question is, how can I make sure the values that the alias is point to can't be changed? It's much easier to be done if it's pointer other than alias...
Thanks in advance.