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

前端 未结 4 1984
粉色の甜心
粉色の甜心 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:55

    add a static function say getForward:

    class Player {
      public:
        Player();
        void setType(PlayerType);
        static PlayerType getForward {
            return FORWARD;
        }
      private:
        PlayerType type;
    };
    

    Then use it in main:

    manager.createPlayer(player, Player::getForward());
    

    This should work.

提交回复
热议问题