title: How do I use the constructor in inherited classes when the parent class doesn't have a default constructor in C++?
body: <p>I have a programming assignment in one of my college classes. The professor gave us specific code to work off of and told us not to alter his code. I am supposed to make a class called GameMgr that inherits from a class called Mgr. Here is a simplified version of what he gave us for Mgr.h:</p>
  
  <pre><code>class Engine;
  
  class Mgr 
  {
  public:
      Engine *engine;
  
      Mgr(Engine *eng);
      virtual ~Mgr();
  };
  </code></pre>
  
  <p>I am attempting to make a class called GameMgr:</p>
  
  <pre><code>class GameMgr: public Mgr
  {
  public:
      GameMgr(Engine* eng);
      void Run();
  };
  </code></pre>
  
  <p>I get an error when trying to compile the code:</p>
  
  <pre><code>error: no matching function for call to ‘Mgr::Mgr()’
   GameMgr::GameMgr(Engine* eng)
                               ^
  </code></pre>
  
  <p><a href="https://codepad.remoteinterview.io/AXCZWMGGDB" rel="nofollow noreferrer">I have made a pad on CodePad with an example</a> (The example in the pad is meant just for this question and isn't my actual code but displays the minimum code needed for this question).</p>
  
  <p>I have tried adding a default constructor to my GameMgr class but I still get errors. I'm assuming that it can be done, being that it is code from my professor, but the only way that I know to solve it is by changing the Mgr class to have Mgr().</p>
  
  <p>How do I use the constructor in inherited classes when the parent class doesn't have a default constructor in C++? </p>
  
  <p>I tried the solution for this question: <a href="https://stackoverflow.com/questions/6923722/how-do-i-call-the-base-class-constructor">How do I call the base class constructor?</a> in my CodePen example and it still isn't working. Therefore, I do not believe that is a solution to my question.</p>