CJCoding With Joseph

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:
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.