[jdom-interest] Re: Subclassing!

Joseph Bowbeer jozart at csi.com
Tue Mar 6 13:56:46 PST 2001


FWIW, I agree.  I just learned that not calling a constructor is part of the
Cloneable contract.

If you override the clone method in a non-final class, you should always
return an object created by invoking super.clone().  This way,
Object.clone() will create a clone of the actual subclass instance,
including its class and its fields.


----- original message -----
From: Ken Rune Helland kenh at csc.no
Date: Tue, 06 Mar 2001 16:55:14 +0100

1. Cloning.
The clonable classes shoud use super.clone()
instead of using new when implementing clone(). This
will allow sublclasses to call super.clone() and
not have to duplicate the functionality of the super class.






More information about the jdom-interest mailing list