12. Copying
The Copying pattern is used to create new object instances by copying existing instances. The act of copying objects is not always as clear cut as you might expect. For example, if you copy an object that contains other objects, should the copy contain the exact same objects as the original, or should the copy contain copies of the objects in the original?
Copying serves as an alternative to the Two-Stage Creation pattern introduced in Chapter 3, “Two-Stage Creation,” and enables the Prototype pattern in Chapter 21, “Prototype.” Copying also plays a role in the Accessor pattern from Chapter 10, “Accessors.” At a higher level, user interface actions, like copy and paste or drag and drop, are often implemented by copying application ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access