title: How can I assign a child class to a base class?
body: <p>I know there are solved questions related to this issue, but I still can't figure out how to resolve my problem.</p>
  
  <p>I have something like this:</p>
  
  <pre><code>class Base
  {
     static Base* createBase()
     {
        Base *b = new Base();
        ... //does a lot of weird things
        return b;
     }
  }
  
  class Child : public Base
  {
     static Child* createChild()
     {
        Child *c = createBase(); // error
        return c;          
     }
  }
  </code></pre>
  
  <p>I know why it doesn't work, but I have to find a way to do it. The createBase function does a lot of things so I don't want to recode it. </p>
  
  <p>Any suggestions?</p>