By default the first enumerator has the value 0, and the value of each successive enumerator is increased by 1.
Example:
enum SomeMonths { January, February, March };
enum OtherMonths { April = 1, May }; //Enumerators can use initializers to override the default values
int v = (int)SomeMonths.January; // 0
v = (int)OtherMonths.May; // 2
Niciun comentariu:
Trimiteți un comentariu