Added real world example of Prototype.

This commit is contained in:
Ilkka Seppälä 2015-02-25 15:50:39 +02:00
parent 6bab9edf75
commit 69e9fb1f5a

View File

@ -87,6 +87,9 @@
* to avoid building a class hierarchy of factories that parallels the class hierarchy of products; or
* when instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state
**Real world examples:**
* [java.lang.Object#clone()](http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#clone%28%29)
## <a name="singleton">Singleton</a> [&#8593;](#list-of-design-patterns)
**Intent:** Ensure a class only has one instance, and provide a global point of access to it.