Introduction of prototype Model (Brief Introduction)
Prototype mode (Prototype pattern): Specifies the type of object to create with a prototype instance, and creates a new object by copying the prototypes.
Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype.
Shallow copy differs from deep copy:
Shallow copy, all the variables copied have the same value as the original object, and all references to other objects still point to the original object.
Deep copy, referring to the object's variable to the copied new object, not the original referenced object.
NET namespace system provides a iconeable interface with only one method clone (), which can be implemented as a prototype (Prototype pattern) with the implementation of this interface.
Ii. issues addressed (What to Solve)
You can consider using prototype mode when an object generation is not through new but by copying old objects.
Prototype Model Analysis 1, prototype pattern structure
Prototype class: Prototype Class Clone () method: Clones its own interface.
Concreteprototypea, Concreteprototypea class: The concrete realization of the prototype class. Clones an operation of its own.