Why am I getting this 'enum' is not a class or a namespace error?

前端 未结 4 1979
粉色の甜心
粉色の甜心 2020-12-10 18:10

I need call a method with this signature in my Manager class:

void createPlayer(Player& player, PlayerType& playerType);

I have a P

4条回答
  •  失恋的感觉
    2020-12-10 18:38

    enum doesn´t create a namespace.

    Therefor PlayerType t = PlayerType::FORWARD; should be changed to:

    PlayerType t = FORWARD;
    

    Notice that c++11 introduce enum classes, which have a namespace. Beside this MSVC has an extension which treats (regular) enums like they have namespace. So your code should actually work with MSVC.

提交回复
热议问题