Look again what’s stated on the wiki screenshot I’ve posted earlier:
// the Foo class must implement the Cloneable interface
// for this code to compile
As I’ve warned you before we’ve gotta code our own clone() function.
Here’s an example of how to implement a clone() method within a class:
1 Like