March 2004
Intermediate to advanced
560 pages
26h 47m
English
public interface ICloneable { // Methods object Clone (); }
|
JR The documentation for this interface states that Clone can make either a shallow or deep copy. This is ridiculous; the standard should have defined Clone as making a deep copy. Without a guarantee of the type of copy, you must be careful how you use a cloned object and have intimate knowledge of what Clone does for a type; this information is usually not documented, leading to problems. KG Echoing Jeffrey's comment, without a contract for ICloneable, which specifies whether it is deep or shallow, this interface is close to unusable. Defining a deep-copy version would have definitely been the most useful approach here. Because of this loose contract, anyone utilizing ... |
Read now
Unlock full access