I have a few comments!
- The Rectangle class needs a destructor, since you wrote a constructor.
- You should use your getter functions to compose the equation in your area function.
- The Cube class inherits the height variable, you dont need to make another private member for the Cube class. The Cube class can also simply use Rectangle's implementation, since nothing is different about it. Save yourself the typing.
Most importantly, default parameters belong in the implementation of the constructor:And of course the loop will be endless until the user types something that isn't 1 or 2. Type 0, for instance, and the loop breaks.Code:Rectangle::Rectangle(double l=0., double w=0.) : length(l), width(w) { }