title: Error: "Allocating an object of abstract class type" despite all virtual functions being implemented
body: <p>I'm receiving error "Allocating an object of abstract class type 'MainGame" even though all virtual functions have been implemented. Below are the relevant code snippets:</p>
  
  <p><strong>main.cpp</strong> </p>
  
  <pre><code>#include "Gamestate_MainGame.h"
  
  int main() {
      Game game;
      if (game.init(new MainGame))
          game.loop();
      return 0;
  }
  </code></pre>
  
  <p><strong>Gamestate.h</strong></p>
  
  <pre><code>#ifndef Gamestate_h
  #define Gamestate_h
  #include &lt;SDL2/SDL.h&gt;
  #include "Game.h"
  
  class GameState {
  public:
      virtual bool init(Graphics* graphics, Game* game) = 0;
      virtual void quit() = 0;
  
      virtual void handleEvents(SDL_Event* e) = 0;
      virtual void logic() = 0;
      virtual void render() = 0;
  
  protected:
      Game* game = NULL;
      Graphics* graphics = NULL;
  };
  #endif
  </code></pre>
  
  <p><strong>Gamestate_MainGame.h</strong></p>
  
  <pre><code>#ifndef Gamestate_MainGame_h
  #define Gamestate_MainGame_h
  #include &lt;vector&gt;
  #include &lt;SDL2_mixer/SDL_mixer.h&gt;
  #include "Gamestate.h"
  #include "Graphics.h"
  #include "Tile.h"
  
  class MainGame : public GameState {
      // Gamestate Functions
      bool init(Graphics* graphics, Game* game);
      void quit();
  
      void handleEvents(SDL_Event&amp; e);
      void logic();
      void render();
  
      // MainGame functions - make private?
      void makeTiles();
      void loadPositions(const int &amp; n);
      void scrambleTiles(std::vector&lt;Tile&gt; t);
      void restart();
  
      bool isSolved();
      bool isNeighbor(const Tile&amp; a, const Tile&amp; b);
      int  getClickedTile(const int&amp; x, const int&amp; y);
  
  private:
      Game* game = NULL;
      Graphics* graphics = NULL;
  
      int  clickedTile { -1 };
      int  clicks      { 0 };
      bool gameExit    { false };
      bool gameWin     { true  };
      bool catMode     { true };
  
      std::vector&lt;Tile&gt; tiles;
      std::vector&lt;SDL_Rect&gt; positions;
  
      Mix_Chunk* click = NULL;
  
  };
  #endif
  </code></pre>
  
  <p><strong>Game.h</strong></p>
  
  <pre><code>#ifndef Game_h
  #define Game_h
  #include &lt;vector&gt;
  #include &lt;SDL2/SDL.h&gt;
  #include "Graphics.h"
  
  class GameState;
  
  class Game {
  public:
      Game();
  
      bool init(GameState* state);
      void loop();
  
      void pushState(GameState* state);
      void popState();
      void setQuit();
  private:
      bool quit { false };
  
      Graphics graphics;
      SDL_Event event;
      std::vector&lt;GameState*&gt; states;
  
      Uint32 new_time;
      Uint32 old_time;
  
      //internal loop functions
      void update();
      void render();
  
      void quitGame(); //will free SDL resources and perform cleanup of states
  };
  #endif
  </code></pre>
  
  <p>All MainGame functions are defined in Gamestate_MainGame.cpp. Thank you for your help!</p>