<<< | Index | >>> |
enum
enum Suit { CLUB, DIAMOND, HEART, SPADE }; Suit s; // enum keyword here not required s = CLUB; // of course s = (Suit) 1; // Ok, not recommended s = 1; // ERROR enum PrintFlags {COLOR=1, LANDSCAPE=2, TWOSIDE=4}; // Range is [0:7] PrintFlags pf = COLOR | TWOSIDE; pf = (PrintFlags) 6; pf = (PrintFlags) 11; // Undefined!! switch ( s ) { // use a default label!!
<<< | Index | >>> |