title: C++ Declaration of class variables in header or .cpp?
body: <p>So far, I've been using classes the following way:</p>
  
  <p>GameEngine.h declares the class as follows</p>
  
  <pre><code>class GameEngine {
  public:
      // Declaration of constructor and public methods
  
  private:
      InputManager inputManager;
      int a, b, c;
  
      // Declaration of private methods
  };
  </code></pre>
  
  <p>My GameEngine.cpp files then just implement the methods</p>
  
  <pre><code>#include "____.h"    
  GameEngine::GameEngine() {
  
  }
  
  void GameEngine::run() {
      // stuff
  }
  </code></pre>
  
  <p>However, I've recently read that variable declarations are not supposed to be in the header file. In the above example, that would be an inputManager and a, b, c.</p>
  
  <p>Now, I've been searching for where to put the variable declarations, the closest answer I found was this: <a href="https://stackoverflow.com/questions/1164167/variable-declaration-in-a-header-file">Variable declaration in a header file</a></p>
  
  <p>However, I'm not sure if the use of extern would make sense here; I just declare private variables that will only be used in an instance of the class itself. Are my variable declarations in the header files fine? Or should I put them elsewhere? If I should put them in the cpp file, do they go directly under the #include?</p>