โ 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: file num Do NOT write a main function.
Expected Output:
file num
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.