Someone asked me about what these were, and for the life of me I can't come up with a good, easy to understand explanation. Someone care to help me out on this one?
Printable View
Someone asked me about what these were, and for the life of me I can't come up with a good, easy to understand explanation. Someone care to help me out on this one?
Do you mean enums?
An enum is a collection of integer constants which are bound logically and (in C++) semantically together.
enum Animals
{
Dog,
Cat,
Mouse,
Horse,
Elephant,
// ...
};
enums are typesafe only on C++:
Animals a = Cat;
int i = a; // needs typecast in C++, not in C
enums are real constants only in C++, the following is invalid in C:
switch(a)
{
case Dog:
break;
case Cat:
break;
}
I'll add if I come up with other things.