title: C++: Redefine one or the other operation in the child class
body: <p>In the following code:</p>
  
  <pre><code>class GraphicalCardDeck : public CardDeck, public GraphicalObject {
  public:
      virtual void draw () {
          return CardDeck::draw();
      }
      virtual void paint () {
          GraphicalObject::draw();
      }
  }
  
  GraphicalCardDeck gcd;
  gcd-&gt;draw();          // selects CardDeck draw
  gcd-&gt;paint();         // selects GraphicalObject draw
  </code></pre>
  
  <p>When in the class <code>CardDeck</code> there is a function named <code>draw</code>, and in the class <code>GraphicalObject</code> there is a function named <code>draw</code>.</p>
  
  <p>The book mentions a problem when we do:</p>
  
  <pre><code>GraphicalObject* g = new GraphicalCardDeck();
  g-&gt;draw(); // opps, doing wrong method!
  </code></pre>
  
  <p>Why will it call the wrong method? It will not call the function <code>draw</code> in the class <code>CardDeck</code> as we define? </p>
  
  <p>Thank you.</p>