โ 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 virtual print() function. A derived class Engineer publicly inherits from Employee. It has no new attributes - it only changes how print() works. Your task is to implement the overridden print() function for Engineer. It should print: Engineer: [name] Do NOT include a main function. Your code will be tested automatically. Expected output: Engineer: Sara
Expected Output:
Engineer: Sara
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.