title: Initialize base class with no default constructor in constructor of derived class
body: <p>I'm trying to create a subclass <code>secondary</code> which could be used with a parameter as well as it's overriding class <code>primary</code>. Now I get</p>
  
  <blockquote>
    <p>no matching function to call</p>
  </blockquote>
  
  <p>error. Could someone help me?</p>
  
  <p>My code:<br>
  primary.h:</p>
  
  <pre><code>#ifndef PRIMARY_H
  #define PRIMARY_H
  
  
  class primary
  {
      public:
          primary(int x);
          virtual ~primary();
      protected:
      private:
          int primary_x;
  };
  
  #endif // PRIMARY_H
  </code></pre>
  
  <p>primary.cpp:</p>
  
  <pre><code>#include "primary.h"
  
  primary::primary(int x)
  {
      primary_x = x;
  }
  
  primary::~primary()
  {
      //dtor
  }
  </code></pre>
  
  <p>secondary.h:</p>
  
  <pre><code>#ifndef SECONDARY_H
  #define SECONDARY_H
  #include "primary.h"
  
  
  class secondary : public primary
  {
      public:
          secondary();
          virtual ~secondary();
      protected:
      private:
  };
  
  #endif // SECONDARY_H
  </code></pre>
  
  <p>secondary.cpp:</p>
  
  <pre><code>#include "secondary.h"
  
  secondary::secondary()
  {
      //ctor
  }
  
  secondary::~secondary()
  {
      //dtor
  }
  </code></pre>