Introduction:
Sometimes we have a case where we want to build an object based on another object instead of creating a new fresh object each time, we can make a copy of an already existing object instantly and start using the new created object. By doing so, we do not have to repeat the building process each time. The newly created object will be independent from the old one.
We can use the Prototype Design Pattern to solve this issue.
Example:
On the following example we will create couple of color objects then Cline those objects into new instances.
abstract class ColorPrototype { public abstract ColorPrototype Clone(); } class ColorManager class Color : ColorPrototype static void Main(string[] args) |