title: Cast forwardly-declared pointer to more specific type
body: <p>I have a class like</p>
  
  <pre><code>class Shape;
  class Triangle;
  class Amorpher
  {
  public:
      Amorpher();
      Amorpher(Shape*);
      Amorpher(Shape&amp;);
      ~Amorpher();
      Shape* pShape;
      void GetShapeArea();
      void Shapeshift(Shape&amp;, string);
      void Shapeshift(Shape*, string);
  private:
      Triangle* triangle;
  };
  </code></pre>
  
  <p>and the implementation</p>
  
  <pre><code>Amorpher::Amorpher()
  {
  }
  Amorpher::Amorpher(Shape* shape) : pShape(shape){}
  void Amorpher::GetShapeArea()
  {
      cout &lt;&lt; "shape area is: " &lt;&lt; pShape-&gt;Area();
  
  }
  
  Amorpher::~Amorpher()
  {
  }
  void Amorpher::Shapeshift(Shape* shape,string shiftTo)
  {
      if (shiftTo == "triangle")
      {
          (Triangle*)shape = triangle;
      }
  }
  </code></pre>
  
  <p>Triangle inherits from shape.  I want in the Shapeshift method to try to cast the Shape passed into the method to a Triangle. Not all Shapes will be Triangles, but why can't I explicitly make this cast?  Does forward declaration have anything to do with the problem? </p>