4 ms·
> In other languages like Java, each class is expected to implement its own clone method This is incorrect. There is an `Object.clone()` in Java, but it's not
by legerdemain 4y ago
> In other languages like Java, each class is expected to implement its own clone method
This is incorrect. There is an `Object.clone()` in Java, but it's not implemented by default for most types, implementing it is fraught with complexity, and the standard book of Java advice strongly recommends avoiding it. If you indicate that your type supports cloning (using the marker interface `Cloneable`), you still only get a shallow copy by default.