My enum is not a class or namespace

前端 未结 4 1972
南笙
南笙 2020-12-05 06:14

Hi I have files called MyCode.h and MyCode.cpp

In MyCode.h I have declared

enum MyEnum {Something = 0, SomethingElse = 1};

class MyClass {

MyEnum e         


        
4条回答
  •  甜味超标
    2020-12-05 06:47

    Scoped enums will not exist until C++0x. For the time being, your code should be

    enumInstance = SomethingElse;
    

    You can create an artificial scoped enum by putting the enum's definition inside its own namespace or struct.

提交回复
热议问题