title: Uninitialized reference member
body: <p>Basically what I want to do is store the reference to the active animation of a sprite as a private member in the Actor class. I want to use a reference so I don't have to actually create the animation multiple times but I keep getting an error.</p>
  
  <p>Actor class declaration:</p>
  
  <pre><code>class Actor
  {
  public:
          Actor();
          ~Actor();
          void setActiveAnimation(Animation anim);
          void draw(sf::RenderWindow&amp; win);
  
  private:
          sf::Sprite sprite;
          MaJR::Animation&amp; activeAnimation;
  };
  </code></pre>
  
  <p>Actor class implementation:</p>
  
  <pre><code>Actor::Actor()
  {
      // constructor
  }
  
  Actor::~Actor()
  {
      // destructor
  }
  
  void Actor::setActiveAnimation(Animation anim)
  {
      activeAnimation = anim;
      activeAnimation.gotoStart();
  }
  
  void Actor::draw(sf::RenderWindow&amp; win)
  {
      sprite.setTexture(activeAnimation.getActiveFrame());
      win.draw(sprite);
      activeAnimation.nextFrame();
  }
  </code></pre>
  
  <p>Build output:</p>
  
  <pre><code>/home/mike/MaJR Game Engine/src/Actor.cpp||In constructor 'MaJR::Actor::Actor()':|
  /home/mike/MaJR Game Engine/src/Actor.cpp|8|error: uninitialized reference member 'MaJR::Actor::activeAnimation' [-fpermissive]|
  ||=== Build finished: 1 errors, 0 warnings ===|
  </code></pre>