Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,177 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,392 people online right now. Registration is fast and FREE... Join Now!




Copy Constructor

 
Reply to this topicStart new topic

Copy Constructor, What is the Deep copy and shallow copy. what is there difference

My_code
10 Jul, 2008 - 06:28 AM
Post #1

New D.I.C Head
*

Joined: 10 Jul, 2008
Posts: 13

What is the Deep copy and shallow copy. what is there difference
User is offlineProfile CardPM
+Quote Post

lordms12
RE: Copy Constructor
10 Jul, 2008 - 07:04 AM
Post #2

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 314



Thanked: 15 times
Dream Kudos: 225
My Contributions
I hope to say it right!!
Deep copy is to copy (copy all levels)the data in another place with another pointer point to it.
Shallow copy is to copy (just copy first level)the pointer point to data into another one (both are pointing to same address).

I mean in deep copy if the original copied object is destroyed the new object will not affect but in shallow copy there might be pointers point to wrong data
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 10:56AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month