Results 1 to 2 of 2
- 04-11-2012, 12:02 AM #1Senior Member
- Join Date
- Feb 2012
- Rep Power
- 04-11-2012, 01:42 AM #2
Re: Copy Constructor with Shallow Copy
A shallow copy merely copies the reference to data, whereas a deep copy duplicates the data itself.
A related term is the lazy copy, which takes advantage of the speed of the shallow copy when at all possible, and becomes a deep copy when necessary.
If you change the value of a shallow copied object, both will reflect the change; not so with a deep copy, which are independent.
All objects have a clone() method which returns a deep copy of the object, apparently.
- By kjkrum in forum Advanced JavaReplies: 3Last Post: 01-23-2012, 08:34 AM
- By ozzyman in forum New To JavaReplies: 3Last Post: 01-05-2012, 11:59 AM
- By Juukamen in forum New To JavaReplies: 2Last Post: 10-29-2011, 01:07 AM
- By shadow7 in forum New To JavaReplies: 6Last Post: 12-29-2009, 07:56 PM
- By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 12:04 AM