Postconditions, Visibility, Exceptions
- Postcondition of redefined method at least as
strong
- Example: Employee.setSalary promises not to decrease
salary
- Then Manager.setSalary must fulfill
postcondition
- Redefined method cannot be more private.
(Common error: omit public when redefining)
- Redefined method cannot throw more checked exceptions
previous |
start |
next .... [Slide 16] ....