21.2 Polymorphic Variables
- Powerful mechanism in the OO paradigm
- Polymorphic - many forms
- Consider our Employee class:
- add annual_income method
- for Employee, this is equal to their yearly salary
- inherit Manager from Employee
- a Manager's annual income is the sum of their salary
and bonus
(Code on next slide)
prev
|top
|next