Doing things im uncofortable with

ben said that i should get in the habit of doing things im uncomfortable with, so here goes…
:rage::alien::rooster::scream::roll_eyes::candle::boom::champagne::rofl:
ok. now that we got that out of the way, i’ll explain what i feel i might understand about const.
const basically means don’t change this
it is commonly used on functions and “variables that arent variables at all, rather constants”
ex:
const int T = 100;
if you put it before a variable (it actually isnt a variable at all anymore, it’s a constant) then it just means this value is constant, never changing.
now, there is also something called a constant function, which merely means this function will not change any variables that are passed into it
ex:
int FBullCowGame::GetMaxTries() const { return MyMaxTries; }
it is perfect here in this getter bc that is all getters do, they get information.
now, ben asked if any of the other function in the declaration could be const, and i believe the answer is that the other getter (int GetCurrentTry()) should be const.

Privacy & Terms