title: Subclass Constructors
body: <p>I am having trouble working with subclasses in C++. I have a class for a Polygon and a subclass that is a Triangle. I would like to be able to declare a Polygon by passing a vector of Point* (which is a custom class) and a Triangle by passing three Point*s.</p>
  
  <p>It is my understanding that the Triangle class constructor should call the constructor of the Polygon class. </p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>class Polygon
  {
  public:
      vector&lt;Point*&gt; pts;
      Polygon(vector&lt;Point*&gt; aPts) : pts(aPts) {};
  };
  class Triangle : public Polygon
  {
  public:
      Triangle(Point* A, Point* B, Point* C) 
      {
          vector&lt;Point*&gt; APts;
          APts.push_back(A); APts.push_back(B); APts.push_back(C);
          Polygon(APts);
      }
  };
  </code></pre>
  
  <p>However, on the opening bracket of the Triangle constructor I get the error:</p>
  
  <pre><code>error: no matching function call to 'Polygon::Polygon()'
  </code></pre>
  
  <p>Can somebody help?</p>