MyConst

Hey programmers!

So I think the “const” variable should be applied to all .

FBullCowGame.h
void Reset()const;
int GetMaxTries() const;
int GetCurrentTry()const;
bool IsGameWon()const ;
bool CheckGuessValidity(std::string)const ;

FBullCowGame.cpp

int FBullCowGame::GetMaxTries() const { return MyMaxTries; }
int FBullCowGame::GetCurrentTry() const { return MyCurrentTry; }
void FBullCowGame::Reset() const {return;}
bool FBullCowGame::IsGameWon() const {return false;}
bool FBullCowGame::CheckGuessValidity(std::string) const {return false;}

The reason being is:
You don’t want code to access or modify the current set amount. So by adding the “const” you eliminate any chances of the program modifying or you accidently modifying.

Privacy & Terms