CJCoding With Joseph
15free / daySign inCreate account

Using Declaration to Unhide Base Overloads

A 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 — print one after the last line.

Hints2 available
Topics:
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.