Creating a new object by copying the current instance/object.Cloning can be implemented in two ways: Shallow copy and deep copy.In Deep copy, all objects are duplicated while in Shallow copy only top-level objects are duplicated and other lower level objects are referenced.For example, consider an object ‘X’ that references objects 'A’ and 'B’. Object 'B’, in turn, references object 'C’. A shallow copy of 'X’ creates new object 'X2’ that also references objects 'A’ and 'B’. In contrast, a deep copy of 'X’ creates a new object 'X2’ that references the new objects 'A2’ and 'B2’, which are copies of 'A’ and 'B’. 'B2’, in turn, references the new object 'C2’, which is a copy of 'C’. The example shows the difference between a shallow and a deep copy. from https://csharpcorner.tumblr.com/post/171158216611
0 Comments
Leave a Reply. |
About Me
Hi I am Carla Smith, I am a software engineering student. I love games and I want to be a gaming programmer in future. ArchivesNo Archives Categories |