Default Argument in Base Constructor
easyQuestion 430Create a base class Greeter and a derived class EnglishGreeter.
Greeter stores a protected string greeting and must have a constructor with a DEFAULT argument: Greeter(string g = "Hello") which sets greeting = g. A getGreeting() const method returns it.
EnglishGreeter has a default constructor EnglishGreeter() {} (already written). Because it does not pass anything to the base, the base's default argument is used.
The program prints the output shown in Expected Output.
Do NOT write a main function.
Expected output
Hello= 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.