search

Home  >  Q&A  >  body text

C/C++中枚举值的访问方法

enum eTaskType{
TYPE_UNKOWN,
TYPE_ADD,
};

or

typedef enum eTaskType{
TYPE_UNKOWN,
TYPE_ADD,
}TaskType;

假如有上述枚举,或者其他定义方法,如何才能通过枚举变量或枚举类型访问成员(通过. -> ::等方式),比如:
TaskType.TYPE_ADD

PHP中文网PHP中文网2785 days ago661

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 11:53:12

    Whether it is eTaskType or TaskType, you can write directly like this:

    • eTaskType::TYPE_UNKNOWN
    • TaskType::TYPE_UNKNOWN

    reply
    0
  • Cancelreply