← Back to Inheritance
Question 290
Abstract Base Class With Pure Virtual
Abstract Base Class With Pure Virtual
The abstract base classShapedeclares a PURE VIRTUAL methodarea()(it has no body, ending in = 0). Complete the derived classRectangleso it stores a width and height and overridesarea()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
Sign in to use hintsTopics:
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.