vimwiki/tech/prototype.wiki

9 lines
332 B
Plaintext

= Prototype =
This is a design pattern where we copy an existing object without making the
code dependent on their classes.
The general idea is sometimes we need an exact clone of an object. We cant copy
the object exactly from the outside, as we dont know the private fields.
Therefore, the object can implement a `clone` method