Update 设计模式 - 原型模式.md

小节标题改为中文,重新绘制类图,补充参考资料。
This commit is contained in:
CyC2018
2026-10-28 03:19:56 +08:00
parent f88413b286
commit f540db57f4
2 changed files with 11 additions and 10 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

+11 -10
View File
@@ -1,15 +1,12 @@
## 6. 原型模式(Prototype)
### Intent
### 意图
使用原型实例指定要创建对象的类型,通过复制这个原型来创建新对象。
### Class Diagram
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/b8922f8c-95e6-4187-be85-572a509afb71.png"/> </div><br>
### Implementation
### 类图
<div align="center"> <img src="pics/dp-prototype.png" width="760px"/> </div><br>
### 实现
```java
public abstract class Prototype {
abstract Prototype myClone();
@@ -47,10 +44,14 @@ public class Client {
}
```
```html
```text
abc
```
### JDK
### JDK 中的应用
- [java.lang.Object#clone()](http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone%28%29)
## 参考资料
- 弗里曼. Head First 设计模式 [M]. 中国电力出版社, 2007.
- Gamma E. 设计模式: 可复用面向对象软件的基础 [M]. 机械工业出版社, 2007.