← Back to Inheritance
Question 610
Pass Values To Base
Pass Values To Base
The base classPersonstores a name and age set through its constructor.Teacherinherits fromPerson. Complete theTeacherconstructor so it forwards BOTH parameters to the base constructor using: base(...). Do NOT write aMainmethod. When the tester createsTeacher("Sam", 30)and callsIntroduce(), the program prints the output shown in Expected Output.
Expected Output:
Sam is 30= 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 (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.