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