Pure Virtual Function With a Definition
hardQuestion 453A pure virtual function (= 0) makes its class abstract, but it may STILL have a body defined out of the class. Subclasses can reuse that shared implementation by calling it with the scope-resolution name.
Create an abstract class Employee with a virtual string describe() const = 0; that ALSO has an out-of-class definition returning "employee". Give Employee a virtual destructor.
Create Manager that overrides describe() to return Employee::describe() + "/manager" by calling the base's provided body.
Both a direct call and a call through an Employee* print the output shown in Expected Output.
Do NOT write a main function.
Expected output
employee/manager employee/manager
= newline. The output ends with a newline, so print one after the last line.
Hints4 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.