title: How do I cast a parent class as the child class
body: <p>It's been a while since I have had to write C++ code and I'm feeling kind of stupid. I've written code that is similar to, <strong>but is not exactly</strong>, the code below:</p>
  
  <pre><code>class Parent
  {
      ...
  };
  
  class Child : public Parent
  {
      ...
  };
  
  class Factory
  {
      static Parent GetThing() { Child c; return c; }
  };
  
  int main()
  {
      Parent p = Factory::GetThing();
      Child c1 = p; // Fails with "Cannot convert 'Parent' to 'Child'"
      Child c2 = (Child)p; // Fails with "Could not find a match for 'TCardReadMessage::TCardReadMessage(TCageMessage)'"
  }
  </code></pre>
  
  <p>I know this is supposed to be simple but I'm not sure what I'm doing wrong.</p>