title: Passing an enum as a parameter
body: <p>I have a Weapon.h/cpp class. thats has an enum</p>
  
  <pre><code>Weapon.h
  enum WEAPONTYPE {
      LASER,
      ROCKET
  }
  </code></pre>
  
  <p>and I have a variable that I'd like to use to track the current enum.</p>
  
  <pre><code>WEAPONTYPE currentWeapon;
  </code></pre>
  
  <p>I have a function that will be called to change the currentWeapon value. The declaration in the header file is:</p>
  
  <pre><code>void weaponSelect(WEAPONTYPE choice);
  </code></pre>
  
  <p>and the declaration in the .cpp file is</p>
  
  <pre><code>void Weapon::weaponSelect(Weapon::WEAPONTYPE enumChoice)
  {
      currentWeapon = enumChoice;
  }
  </code></pre>
  
  <p>Now the error I recieve is:</p>
  
  <p>error C2511: 'void Weapon::weaponSelect(Weapon::WEAPONTYPE)' : overloaded member function not found in 'Weapon'</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Edit 1:</p>
  
  <hr>
  
  <p>Weapon.h</p>
  
  <pre><code>#ifndef WEAPON_H_
  #define WEAPON_H_
  
  class Weapon
  {
  public:
      Weapon(Ogre::SceneManager* localManager);
      virtual ~Weapon(void);
  
      void createBullet(Ogre::Vector3 cameraPosition);        //Create bullet nodes/entities.
      void weaponSelect(WEAPONTYPE enumChoice);                   //Function to select weapon type. Tried to have "WeaponType enumChoice" as parameter but would produce error.
      void updateBullet();                                    //Update bullet logic.
  
      enum WEAPONTYPE {
          LASER = 0,
          ROCKET = 1
      };
  
  private:
      WEAPONTYPE currentWeapon;               //Enum var to track weapon selected.
      Ogre::SceneManager* localBulletSceneManager;    //Pointer to our application's scene manager
      std::vector&lt;Ogre::SceneNode*&gt;   bullets;        //List of pointers to the bullet nodes.
  };
  #endif
  </code></pre>
  
  <p>Weapon.cpp</p>
  
  <pre><code>#include "Weapon.h"
  #include &lt;OgreStringConverter.h&gt;
  
  using Ogre::SceneNode;
  using Ogre::Entity;
  using Ogre::String;
  using Ogre::Vector3;
  
  Weapon::Weapon(Ogre::SceneManager* localManager)
  : localBulletSceneManager(nullptr)
  , currentWeapon(LASER)
  {
      this-&gt;localBulletSceneManager = localManager;
  }
  
  Weapon::~Weapon(void)
  {
  
  }
  
  void Weapon::weaponSelect(WEAPONTYPE enumChoice)
  {
      this-&gt;currentWeapon = enumChoice;
  }
  
  void Weapon::createBullet(Vector3 cameraPosition)
  {
      //Pointers to use for Quick Node and Entity Creation - Get Reused once object is attached to scene.
      SceneNode* tempNode = nullptr;
      Entity*    tempEntity  = nullptr;
  
      //All our Objects are spheres, so create one mesh and reuse it with each entity.
      String bulletMesh = "Bullet";
      //Procedural::SphereGenerator().setRadius(1.f).setUTile(5.).setVTile(5.).realizeMesh(bulletMeshName);
      Procedural::ConeGenerator().setRadius(0.5F).setHeight(3.0F).realizeMesh(bulletMesh);
  
      for (int bulletAmount = 0; bulletAmount &lt; 10; ++bulletAmount)
      {
          tempNode    = this-&gt;localBulletSceneManager-&gt;getRootSceneNode()-&gt;createChildSceneNode("RocketNode" + Ogre::StringConverter::toString(bulletAmount));
          tempEntity  = this-&gt;localBulletSceneManager-&gt;createEntity("RocketEntity" + Ogre::StringConverter::toString(bulletAmount), bulletMesh);
          //tempEntity-&gt;setMaterial(
  
          tempNode-&gt;attachObject(tempEntity);
          tempNode-&gt;setPosition(0,0,100 + (bulletAmount * 10));
      }
  
      switch (this-&gt;currentWeapon)
      {
      case LASER:
          break;
  
      case ROCKET:
          break;
      }
  }
  </code></pre>
  
  <p>Edit 2:
  Reverted declaration for void weaponSelect in both .h and .cpp to the original version without any changes suggested by other posters.</p>