Diamond Problem With Virtual Inheritance
hardQuestion 450When two classes inherit from the same base and a fourth class inherits from both, you get the "diamond problem": two copies of the base and ambiguous member access. virtual inheritance fixes this by keeping a SINGLE shared base subobject.
Person (already written) has string role() const returning "person".
Create Student and Employee that each inherit from Person using VIRTUAL inheritance, and TeachingAssistant that inherits from both Student and Employee.
Because of virtual inheritance, role() on a TeachingAssistant is unambiguous. The program prints the output shown in Expected Output.
Do NOT write a main function.
Expected output
person= 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.