Interface IPrototype<T>
- Namespace
- WitShells.DesignPatterns.Core
Defines the contract for the Prototype pattern. Classes implementing this interface are responsible for producing a deep copy of themselves, allowing the creation of new objects by cloning an existing configured instance rather than constructing one from scratch.
public interface IPrototype<T>
Type Parameters
TThe type of the object being cloned.
Remarks
Useful when object creation is expensive and you have an existing instance whose state you want to duplicate (e.g. prefab-like configurations, level templates).
Methods
Clone()
Creates a deep copy of the current instance.
T Clone()
Returns
- T
A new instance that is a copy of the current instance.