title: C++ Overridden method not getting called
body: <p>Shape.h</p>
  
  <pre><code>namespace Graphics {
      class Shape {
      public:
          virtual void Render(Point point) {};
      };
  }
  </code></pre>
  
  <p>Rect.h</p>
  
  <pre><code>namespace Graphics {
      class Rect : public Shape {
      public:
          Rect(float x, float y);
          Rect();
          void setSize(float x, float y);
          virtual void Render(Point point);
  
      private:
          float sizeX;
          float sizeY;
      };
  }
  
  struct ShapePointPair {
      Shape shape;
      Point location;
  };
  </code></pre>
  
  <p>Used like this:</p>
  
  <pre><code>std::vector&lt;Graphics::ShapePointPair&gt; theShapes = theSurface.getList();
  
  for(int i = 0; i &lt; theShapes.size(); i++) {
      theShapes[i].shape.Render(theShapes[i].location);
  }
  </code></pre>
  
  <p>This code ends up calling <code>Shape::Render</code> and not <code>Rect::Render</code></p>
  
  <p>I'm assuming this is because it is casting the <code>Rect</code> to a <code>Shape</code>, but I don't have any idea how to stop it doing this. I'm trying to let each shape control how it is rendered by overriding the <code>Render</code> method.</p>
  
  <p>Any ideas on how to achieve this?</p>