← Back to Inheritance
Question 138
Employee Engineer Inheritance
Employee Engineer Inheritance
A base class Employee has been provided with protected members id (int) and name (string), a constructor, and a virtualprint()function. A derived class Engineer publicly inherits from Employee. It has no new attributes - it only changes howprint()works. Your task is to implement the overriddenprint()function for Engineer. It should print: Engineer: [name] Do NOT include a main function. Your code will be tested automatically.
Expected Output:
Engineer: Sara= newline. The output ends with a newline — 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.