What functions to 'const'?

Correct me if I’m wrong, but I think GetMaxTries() should be the only function that remains constant.
All the others, such as GetCurrentTry(), change during the course of the game, so there wouldn’t be much use to have say, GetCurrentTry() constant since CurentTry gets changed every time the player tries a word.

Or have I understood wrong?

Hi,

I believe GetCurentTry() should also be const as it itself does not change CurrentTry.

It is only a getter - therefore it reads the variable and returns it. The variable is allowed to change but the getter is not allowed to change it.

1 Like

The question is how could “it” change the variable - on the long run, I reckon?

Privacy & Terms