CJCoding With Joseph
15free / daySign inCreate account

Pure Virtual Function With a Definition

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

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