CJCoding With Joseph

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:
employee/manager
employee/manager

Do NOT write a main function.

Expected Output:

employee/manager
employee/manager
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.