← Back to Inheritance
Question 442
Using Declaration to Unhide Base Overloads
Using Declaration to Unhide Base Overloads
Ausingdeclaration brings hidden base overloads back into a derived class's scope so they can be called WITHOUT qualification. Base classLogger(already written) hasstring write() constreturning "base" andstring write(int n) constreturning "num". Create a derived classFileLoggerthat: 1. addsusing Logger::write;to un-hide the base overloads 2. declares its ownstring write() constreturning "file" Nowf.write(3)works directly. The runner prints the output shown in Expected Output. Do NOT write a main function.
Expected Output:
file num
= 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.