deep copy vs shallow copy

Questions about programming languages and debugging
Post Reply
User avatar
z3r0aCc3Ss
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 700
Joined: 23 Jun 2009, 16:00
14
Contact:

deep copy vs shallow copy

Post by z3r0aCc3Ss »

Can anybody please explain me the difference between deep copy and shallow copy with respect to C++?
I Googled about it, and got gOOgled...
Please explain with code snippet.
Beta tester for major RATs, all kinds of stealers and keyloggers.
Learning NMAP

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: deep copy vs shallow copy

Post by lilrofl »

Shallow copy is the default method in C++, and is used to copy classes that do not contain dynamically allocated variables,

Deep copy is used when a class contains dynamically allocated variables

Code: Select all

http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying/
has a really good article on the difference, including the code snippets to explain.
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

Post Reply