上QQ阅读APP看书,第一时间看更新
UML class structure
The following UML diagram shows all the components of the Prototype design pattern:
UML diagram for Prototype design pattern
Let's see these components as listed in following points:
- Prototype: The Prototype is an interface. It is uses the clone method to create instances of this interface type.
- ConcretePrototype: This is a concrete class of the Prototype interface to implement an operation to clone itself.
- Client: This is a caller class to create a new object of a Prototype interface by calling a clone method of the prototype interface.
Let's see a sample implementation of the prototype design pattern.