title: Issue with C++ constructor
body: <p><strong>EDIT:</strong> This question came up and I think I aced it! Go StackOverflow!! :D</p>
  
  <p>I have exams coming up, and one of the questions on last year's exams was to spot the problem with implementation of the following constructor and to write a corrected one.</p>
  
  <pre><code>Rectangle::Rectangle(string col, int len, int br)
  {
      setColour(col);
      length =len;
      breadth=br;
  }
  </code></pre>
  
  <p>The class definitions are as follows:</p>
  
  <pre><code>class Polygon
  {
  public:
      Polygon(string col="red");
      void printDetails(); // prints colour only
      virtual double getArea()=0;
      void setColour(string col);
  private:
      string colour;
  };
  
  
  class Rectangle : public Polygon
  {
  public:
      Rectangle(string, int, int);
      void printDetails(); // prints colour and area
      // for part 3, delete the line below
      double getArea();
  private:
      int length;
      int breadth;
  };
  </code></pre>
  
  <p>I've written the code into the compiler and it runs fine. I'm guessing the question is relating to inheritance, since <code>string colour;</code> is private, but <code>setColour</code> is public so I cant figure it out. Unless its <code>Rectangle::Rectangle(string col, int len, int br):length(len), breadth(br)</code> and then set the colour inside the construcor or something.</p>
  
  <p>Its only worth 3 marks so its not that big a deal if nobody wants to answer, but I figure if I'm going to have a career as a programmer, its in my interest to know as much as possible. ;)</p>
  
  <p>Thanks for any help.</p>
  
  <p><strong>PS</strong>, see <code>getArea()</code> in <code>Rectangle</code>. When I remove that it tells me it "cannot instantiate the abstract class". What does that mean?</p>
  
  <p>EDIT: Here's the main:</p>
  
  <pre><code>void main (void)
  {
      Rectangle rect1 ("blue",5,6);
      Rectangle *prect2 = new Rectangle("red",5,6);
      rect1.setColour("red");
      rect1.printDetails();
      prect2-&gt;printDetails();
  }
  </code></pre>