title: Composition pattern
body: <p>How should one approach composition instead of inheritance? Consider the following class:</p>
  
  <pre><code>class GameObject {...};
  
  class Sprite {
  public:
      void changeImage(...);
  };
  
  class VisibleGameObject: public Sprite, public GameObject {};
  
  class VisibleGameObject : public GameObject {
      protected:
          Sprite m_sprite;
  };
  </code></pre>
  
  <p>The first VisibleGameObject class uses inheritance. Multiple inheritance. Does not looks good. Second one is what i would like to use, but it won't allow me to access Sprite's API like this:</p>
  
  <pre><code>VisibleGameObject man;
  man.changeImage();
  </code></pre>
  
  <p>How can that be accomplished without inheritance (or code duplication)?</p>
  
  <p>EDIT:
  I do know I can just use inheritance or make <code>m_sprite</code> a public member and I can't access the Sprite class because it's <code>private</code>. That's the point, the question is about the best way to change a <code>VisibleGameObject</code>'s Sprite, following the rules of data encapsulation.</p>