← Back to Inheritance
Question 136
Override and Call Base Function
Override and Call Base Function
A base class Message has been provided with a virtual functiondisplay()that prints "Message". A derived class WarningMessage publicly inherits from Message. Thedisplay()function has been declared with the override keyword. Your task is to implementWarningMessage::display()so that it: 1. First calls the base class versionMessage::display()2. Then prints "Warning" on a new line Do NOT include a main function. Your code will be tested automatically.
Expected Output:
Message Warning
= newline. The output ends with a newline — print one after the last line.
Hints3 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.