Definition

A partial or fully initialized object that you clone and make use of it

Motivation

  • Complicate objects aren’t created from scratch
    • They reiterate existing design
  • An existing design is a prototype
  • We make a copy of the prototype and customize it
    • Require Deep Copy support
  • We make the cloning convenient

Prototype via Serialization

  • Boost library

Summary

Implement a prototype

  • Construct an object and store it somewhere

Clone a prototype

  • Implement a deep copy function
  • Serialize and deserialize

Customize the result interface