clone()方法 [英] The clone() method

查看:56
本文介绍了clone()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们不能只扩展将使用克隆方法的类,以便能够在不重写的情况下使用它?

why can''t we just extend the class that will be using the clone method in order to be able to use it without overiding?

推荐答案

会发生什么当你尝试那个?
What happens when you try that?


相同的消息克隆受到保护
the same message clone is protected



'的确切含义;复印"可能取决于对象的类。
The precise meaning of "copy" may depend on the class of the object.



也意识到为了能够生成自己的克隆,你必须是Cloneable。

Realize also that to be able to produce clones of yourself, you must be Cloneable.


这篇关于clone()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆