Using Declaration to Unhide Base Overloads
mediumQuestion 442A using declaration brings hidden base overloads back into a derived class's scope so they can be called WITHOUT qualification.
Base class Logger (already written) has string write() const returning "base" and string write(int n) const returning "num".
Create a derived class FileLogger that:
1. adds using Logger::write; to un-hide the base overloads
2. declares its own string write() const returning "file"
Now f.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, so 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.