CJCoding With Joseph
15free / daySign inCreate account

Abstract Base Class With Pure Virtual

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 — 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.