Suppose we have an enum like the following:
enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday};
I want to make an instance of this enum and give it an appropriate value, so I do the following:
Days day = Days.Saturday;
Now I'd like to compare my variable or instance to an existing enum value, thus I'll perform the following:
if (day == Days.Saturday)
{
std::cout << "Ok its Saturday";
}
Which gives me a compilation error:
error: expected primary-expression before ‘.’ token
So, just to be clear, what's the difference between:
if (day == Days.Saturday) // Causes compilation error
and
if (day == Saturday)
?
What do these two truly mean, because one is OK and the other generates a compilation error?