-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2019-08-14:谈谈你对原型模式的理解? #121
Comments
不会,谢谢 |
用原型类声明创建对象的种类,通过克隆创建对象 |
通过克隆一个已存在的实例,来"实例化"一个新的实例。 |
原型模式 在已有对象实例的基础上快速生成与其一样的实例 |
1.定义
Android 源码中例子: 原型模式实质上就是对象拷贝,要注意深拷贝和浅拷贝问题. 还有就是保护性拷贝,就是某个对象对外是只读的,为了防止外部对这个只读对象修改,通常可以通过返回一个对象的拷贝来实现只读的限制. 优点: 缺点: |
No description provided.
The text was updated successfully, but these errors were encountered: