CJCoding With Joseph
15free / daySign inCreate account

The abstract base class Shape declares a PURE VIRTUAL method area() (it has no body, ending in = 0). Complete the derived class Rectangle so it stores a width and height and overrides area() to return width times height.

The provided main creates a Rectangle through a Shape pointer and prints its area.

Expected output

20

= newline. The output ends with a newline, so print one after the last line.

Hints2 available
Topics
Inheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.