CJCoding With Joseph
15free / daySign inCreate account

Override With Base Call and Extra Logic

You are given a base class Logger with a virtual function log() that prints a timestamp message.

Create a derived class FileLogger that:
- Publicly inherits from Logger
- Has a private string member: filename
- Has a constructor taking a string filename
- Overrides log() to:
  1. First call Logger::log() (to print the timestamp)
  2. Then print "Saving to: [filename]"

This pattern is common in real software: the derived class extends (not replaces) the base behavior.

Do NOT include a main function. Your code will be tested automatically.

Expected Output:

[LOG] Timestamp recorded
Saving to: output.txt

= newline. The output ends with a newline — print one after the last line.

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