java clone()不具备传递性。
如 Student extends Person {}
Student stu1 = new Student(), Student stu2= stu1.clone();
此时使用了stu1的clone()方法,需在Student中重写clone()方法,如在Person中重写了clone()方法,而在Student中未重写clone()方法,则上面的stu1.clone()使用依旧会报错。
以此记录clone()方法不具备继承传递性。
java clone()不具备传递性。
如 Student extends Person {}
Student stu1 = new Student(), Student stu2= stu1.clone();
此时使用了stu1的clone()方法,需在Student中重写clone()方法,如在Person中重写了clone()方法,而在Student中未重写clone()方法,则上面的stu1.clone()使用依旧会报错。
以此记录clone()方法不具备继承传递性。