Difference between revisions of "Prototype"

From CDOT Wiki
Jump to: navigation, search
(Related Patterns)
Line 30: Line 30:
== Related Patterns ==
== Related Patterns ==

Revision as of 23:50, 17 March 2007

Prototype Design Pattern

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. -- "Design Patterns" Gamma et al., Addison-Wesley, ISBN:0-201-63361-2" 

Friendly Definition:
Prototype pattern is a creational pattern. Meaning it deals with the most efficient ways to create object in a given situation. when you do not want to directly call an objects' constructor , you can use this pattern to clone an existing object of that class thus reducing the number of classes. The basic principle behind this pattern is to determine the type of objects to be created by using a prototypical reference.


Side effects

Pattern diagram


Sample code

Related Patterns

  • a

  • b

  • c