Solution (source code)

= Solution

The <prototype pattern> is a <creational pattern>: a client asks a configured object to clone itself through a common <object interface>, and concrete prototypes implement the cloning operation. The client can thereby create objects without naming their concrete classes at every creation site.

Use it when the required configuration or concrete type is chosen at runtime, or when reconstructing expensive initial state is less convenient than copying a prepared example. A <deep copy> may be needed for independently mutable nested data; merely duplicating outer fields can leave <reference aliasing>. The cloning contract determines what is copied and what may safely be shared.