vimwiki/tech/prototype.wiki

9 lines
332 B
Plaintext
Raw Normal View History

2022-03-16 02:30:01 +00:00
= 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