โ Back to Inheritance
Question 520
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: Sam is 30
Expected Output:
Sam is 30
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.