Creating a Square, extending the Rectangleclass
We will now use the rectangle class as the base class for aSquare. This is the key concept for inheritance. This derivedclass, the Square class will take on all the qualities of arectangle, but create a more focused set of qualities. In the classyou will create:
- The private data shall consist of 0 members:
- There is no private data, alldata is inherited from the base class.
- One constructor
- A single constructor with 1 parameter that calls the baseconstructor.
- One mutator
- setLength to set the side length.
- Two accessors:
- getLength to get the side length.
- printObject that over-rides the print accessor of the
OROR