Enums

From Suhrid.net Wiki
Revision as of 22:25, 24 June 2011 by Suhridk (talk | contribs) (Created page with "* Enums are a feature that allows a variable to be restricted to having only a few predefined values. * e.g. if we want to restrict a variable that represents t-shirt sizes to on...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  • Enums are a feature that allows a variable to be restricted to having only a few predefined values.
  • e.g. if we want to restrict a variable that represents t-shirt sizes to only one of four possible sizes, we can use an enum:
enum TShirtSize {
     S,
     M,
     L,
     XL
};