CJCoding With Joseph

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
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.