I was wandering how can Object.Clone() access field fields that are actually defined in the subclasses, and not the actual implementation of this feature.What is bothering me is that I cannot see the logic to allow base class (even if it is special) to access the fields defined in the subclasses - doesn't this breaks whole object inheritance concept?Consider this:class Test implements Cloneable{    private String test_field;    public Test()    {    }    public Test clone() throws CloneNotSupportedException    {       return (Test)super.clone();    }}Here, calling Test.clone() will copy the test_field also. Things are even getting weirder for me when it comes to the situation where Test is declared as an abstract class - calling clone() will allow me (in some way) to get the instance of the abstract class.
Why Object.clone() is able to see fields defined in subclasses?
java
See this answer on SO https://stackoverflow.com/a/2326801/643483The short answer to your question is yes, it is problematic to have the clone method on the Object class. According to Josh Bloch (via above link), it would have been better for the clone method to be defined on the Cloneable interface.