Depth copies of reference data type (complex data type) assignment!
Shallow copy : a reference data type of the address, assigned to the other variable storage, without any treatment known as a shallow copy.
int1 is stored in a variable address memory array;
The memory address stored int1, assigned to INT2, two variables are stored in the same memory address;
Because int1 and INT2, while storing the same data as the memory address, an array is the same operation,
Therefore, int1, the array operation change, int2 will change;
Shallow copy
: direct assignment of the memory address, after the assignment, the content of the same two variables, one operation, the other will also change.
Deep copy
: assignment reference only numeric data types instead of copying the address, the same memory addresses becomes a deep copy.
Int1 only copy of the data;
Loop through, to get all the data values in int1, assigned to the new array;
By cycle, generating all int1 superscript index;
int1 [I] is to obtain data stored in int1,
int2.push () the data int1 int1 [i], written into the int2;
Deep copy
: looping through, obtaining reference data types, each data store is assigned to the new variable, the assignment after
Two variables have different memory addresses, nothing to do.