What is the difference between Enum and Static Enum in C++ ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JyotiranjanR
    New Member
    • Jul 2010
    • 1

    What is the difference between Enum and Static Enum in C++ ?

    Hi all,

    I wanted to know, What is the difference between Enum and Static Enum in C++ ?

    Thanks.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    enum is not a type.

    An enum is a list of named integer values:

    Code:
    enum Color = {RED, BLUE, GREEN};
    You can create variables wit the enum name rather than the value:

    Code:
    enum Color Data = BLUE;
    At this point Data is an int with a value of 1.

    Therefore a static enum Color is just a static int.

    Comment

    Working...