title: C++ Inheritance: Error: candidate expects 1 argument, 0 provided
body: <p>in the following program, I want to derive a class from a base class. In my code everything seems to be OK. However, I am getting error shown in the below program. Please explain the reason for the error, and how to correct it. </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  struct Base
  {
      int x;
      Base(int x_)
      {
          x=x_;
          cout&lt;&lt;"x="&lt;&lt;x&lt;&lt;endl;
      }
  };
  
  struct Derived: public Base
  {
      int y;
      Derived(int y_)
      {
          y=y_;
          cout&lt;&lt;"y="&lt;&lt;y&lt;&lt;endl;
      }
  };
  
  int main() {
      Base B(1);
      Derived D(2);
  }
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>Output:
  
   error: no matching function for call to 'Base::Base()
   Note: candidate expects 1 argument, 0 provided
  </code></pre>