How to use enums in C++

前端 未结 14 689
臣服心动
臣服心动 2020-12-04 04:30

Suppose we have an enum like the following:

enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday};

I want to crea

14条回答
  •  猫巷女王i
    2020-12-04 05:19

    Sadly, elements of the enum are 'global'. You access them by doing day = Saturday. That means that you cannot have enum A { a, b } ; and enum B { b, a } ; for they are in conflict.

提交回复
热议问题