The prototype creational pattern is great for creating objects that you may not know about ahead of time. If your program allows users to build complex objects from simpler components and then needs to build more of these complex objects or if your program loads plugins at runtime, then it can benefit from this design pattern.

In order to understand and get the most benefit from this pattern, you need to understand the difference between a shallow copy and a deep copy. Shallow vs. deep copies are normally discussed when working with classes that have pointers or references especially to other class types which could also have pointers and references. A shallow copy just copies the first class data members as-is so that any pointers in the copy will point to the same data as in the original. A deep copy will change pointers so they point to their own copy of whatever the original points to. Deep copies will also continue this pattern looking for any possibility of shared data.

To make use of the prototype design pattern, just create a base class with a virtual method called clone which returns a pointer to another base class. The clone method will implement a deep copy and return a pointer to the base class. Your original code will just work with the base class pointer without worrying about what specific type it actually points to. After all, this type could be some new type defined by a plugin or some add-on which your code has no idea even exists.