Well first of all I should begin with saying that English isn’t my main language and I feel that this is a bit tricky to get my head around possibly because of the language barrier.
From what I understand is that const makes is impossible for me to change the variables inside the functions from anywhere other then where I declared its value. If that is so shouldn’t GetMaxTries() function be open if you would like to alter it if say you want difficulty level. Lets say hard is 4 guesses and easy 12 guesses.
Now please correct me if I’m wrong, didn’t understand what this is all about or w/e it could be
// a swede interested in programming
EDIT: Apparently I got this idea wrong and I need some to work with it some more to understand whats it’s all about.
Nothing to do with what the types are. It’s all about the class’ data
class Person
{
public:
void NonConstFunction(); //can change class data
void ConstFunction() const; //can't change class data
private:
int ID;
std::string Name;
};
void Person::NonConstFunction()
{
//both valid
ID = 4;
Name = "Bill";
}
void Person::ConstFunction() const
{
//Not class data; fine to modify
int FakeID = 3;
FakeID = 4;
//attempting to modify class data; invalid
ID = 10;
Name = "Jim";
}
I got a little bit lost at the whole class, header part and all but it’s making more sens by the time.
I get the concept but all the syntax between it all is a bit to wrap your head around.