โ 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 function display() that prints "Message". A derived class WarningMessage publicly inherits from Message. The display() function has been declared with the override keyword. Your task is to implement WarningMessage::display() so that it: 1. First calls the base class version Message::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
Expected Output:
Message Warning
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.