Programmer example
Input
do_work(Programmer('Ada'))
Output
Programmer Ada is coding
Programmer overrides work() to return a message about coding; do_work simply calls worker.work() and returns that string.
Full lesson preview
Implement subclass-specific behavior and call it through a common interface without type checks.
Problem statement
Task
Examples
Input
do_work(Programmer('Ada'))
Output
Programmer Ada is coding
Programmer overrides work() to return a message about coding; do_work simply calls worker.work() and returns that string.
Input format
Output format
Constraints
Samples
Input
do_work(Chef('Gordon'))
Output
Chef Gordon is cooking
Chef.work() returns the cooking message and do_work returns it unchanged.