Cloning and Inheritance
- Object.clone is paranoid
- clone is protected
- clone only clones Cloneable objects
- clone throws checked exception
- You don't have that luxury
- Manager.clone must be defined if
Manager adds mutable fields
- Rule of thumb: if you extend a class that defines
clone, redefine clone
- Lesson to learn: Tagging interfaces are inherited. Use them
only to tag properties that inherit
previous |
start |
next .... [Slide 36] ....