Because clone has protected access in Object and, to call clone , you have to call it through a reference to a class that has overridden clone to be public.
因为clone在Object中是保护访问的,调用clone必须通过将clone改写公共访问的类引用来完成。
Therefore when you make a change in the data member object, the original and the clone will be both changed.
因此,当你修改这个对象中的一个数据成员时,原始的和克隆的数据成员都会被改变。
A deep clone of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.
对象的深层克隆创建对象的副本以及该对象直接或间接引用的所有内容的副本。
If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super. clone need to be modified.
如果一个类只包含基本字段或对不变对象的引用,那么通常不需要修改super .clone返回的对象中的字段。
This creates a complete copy of the current binding element object tree, also called a deep clone.
这将创建当前绑定元素对象树的完整副本,也称为深层克隆。
This creates a complete copy of the current binding element object tree, also called a deep clone.
这将创建当前绑定元素对象树的完整副本,也称为深层克隆。
应用推荐