Skip to content

Files

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Inheritance

You are making a drawing application, which has a Shape base class.

The given code defines a Rectangle class, creates a Rectangle object and calls its area() and perimeter() methods.

Do the following to complete the program:

  1. Inherit the Rectangle class from Shape.
  2. Define the perimeter() method in the Rectangle class, printing the perimeter of the rectangle.

The perimeter is equal to 2 * (width + height)