title: C++ polygon rectangle and triangle inheritance
body: <p>I am trying to make a Polygon class and a Rectangle and Triangle that inherit the first. Polygon class has height and width variables that I want them to be be given values within the constructor. Then, Rectangle and Triangle have area calculation methods. Then, I use a main() to give some examples. I use:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class Polygon {
      public:
          Polygon(int, int);
      protected:
          int height;
          int width;
  };
  
  class Rectangle: public Polygon {
      public:
          void calc_area();
  };
  
  class Triangle: public Polygon {
      public:
          void calc_area();
  };
  
  Polygon::Polygon(int a, int b) {
      height = a;
      width = b;
  }
  
  void Rectangle::calc_area() {
      cout &lt;&lt; "Rectangle area: " &lt;&lt; (height*width) &lt;&lt; endl;
  }
  
  void Triangle::calc_area() {
      cout &lt;&lt; "Triangle area: " &lt;&lt; (height*width/2) &lt;&lt; endl;
  }
  
  int main() {
      Rectangle s1(5, 2);
      Triangle s2(5, 2);
      s1.calc_area();
      s2.calc_area();
  }
  </code></pre>
  
  <p>But while everything looks ok to my newbie eyes, I get a series of errors:</p>
  
  <p>12 base Polygon' with only non-default constructor in class without a constructor `</p>
  
  <p>36 no matching function for call to `Rectangle::Rectangle(int, int)</p>
  
  <p>37 no matching function for call to `Triangle::Triangle(int, int)'</p>
  
  <p>Can someone give me some tips? As seen, I am very new to C++...</p>