title: Passing arguments to a superclass constructor
body: <p>I'm just getting into derived classes, and I'm working on the famous <code>Shape</code> class. <code>Shape</code> is the base class, then I have three derived classes: <code>Circle</code>, <code>Rectangle</code>, and <code>Square</code>. <code>Square</code> is a derived class of <code>Rectangle</code>. I think I need to pass arguments from the derived class constructors to the base class constructor, but I'm not sure exactly how to do this. I want to set the dimensions for the shapes as I create them. Here is what I have for the base class and one derived class:</p>
  
  <pre><code>Shape(double w = 0, double h = 0, double r = 0)
  {
       width = w;
       height = h;
       radius = r;
  }
  
  
  class Rectangle : public Shape
  {
       public:
       Rectangle(double w, double h) : Shape(double w, double h)
       {
           width = w;
           height = h;
       }              
       double area();
       void display();      
  };
  </code></pre>
  
  <p>Am I on the right track here? I'm getting the following compiler error: <code>expected primary expression before "double"</code>, in each of the derived constructors.</p>