Prototype
A. Definition:
Use a prototype instance to specify the type of the object to be created, and create a new object by copying the prototype instance.
B. Definition Analysis:
" UsePrototype instancesSpecify the type of the object to be created, and create a new object by copying the prototype instance ." A prototype instance refers to a class instance. For the object we want to create, it is called a prototype.
"Specify the type of the object to be created using the prototype instance, Create a new object by copying the prototype instance. "The object we are going to create is the same as the prototype instance, that is, a class.
"Specify the type of the object to be created using the prototype instance,Create a new object by copying a prototype instance. "When creating a new object, you don't need to create new by yourself. You only need to create a new instance by using the clone method provided by the prototype.
This mode is easy to think about, and you will think about it when you need it.
C. Problem
(1) When will the prototype be applied?
It takes a lot of time and conditions to create a new instance...
When a new instance needs to inherit most of the features of an existing instance...
....