C
Chris Smith
Thomas Hawtin said:There is only need to implement Cloneable if you are going to use the
Object implementation of clone. There is not a pressing need to make
clone public (or add package private access when you override). Prior to
1.5, using a different method allows a useful return type. Using
Object.clone has dangers (admittedly, as does copying lots of fields one
by one).
Then again, using Object.clone() is the only reasonable way to get
correct object copying behavior in a non-final class with accessible
(protected or public) constructors. That's the fundamental reason to
use clone() instead of a copy constructor anyway... so yes, I'd say that
implementing Cloneable is fairly important.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation