hello ppl,
i searched thru google but i didnt find the exact explanation for
constructors.
Shallow Copy , Deep Copy , Memberwise Copy ,Bitwise copy
i got some conflicting answers..
and what is the difference between them..
.pls help me..
manish
hello ppl,
i searched thru google but i didnt find the exact explanation for
constructors.
Shallow Copy , Deep Copy , Memberwise Copy ,Bitwise copy
i got some conflicting answers..
and what is the difference between them..
.pls help me..
manish
Shallow Copy , Deep Copy , Memberwise Copy ,Bitwise copy
Ty Y
Shallow copy = Bitwise copy.
Deep copy = Memberwise copy.
Long story short, a shallow copy only copies the binary, in memory, print of a class. A deep copy "dives into" the members, and copy their logical data.
Example: If you've got a class with one member, which is a pointer of irrelevant type, a shallow copy would duplicate the address, leaving you with two classes with pointers to the same value. A deep copy would copy what the pointer addresses, again giving you two classes, but each with a pointer to its own value. Not only will the class be copied, but also whatever types it contains.
Bobby110uk
Sascha Zeidler
Hi,
I was confused about these expressions too and looked at your explanations and they were very sensible. But while I was looking at the object browser in visual studio 2005 I saw the following:
protected object MemberwiseClone()
Member of System.Object
Summary:
Creates a shallow copy of the current System.Object.
Return Values:
A shallow copy of the current System.Object.
This indicates to me that a memberwiseclone is a shallow copy not a deep copy as you have stated above. So I am still confused as to the correct definitions of a memberwise, bitwise, shallow and deep copy. Perhaps the object browser is wrong or perhaps there is some question over these definitions.
Kind Regards
Andy
zapacila89
thanks friends for helping me.
finally i got rid of all confusion
thanks a lot
manish
Rusty Trawler
Yes, "byte by byte" is more appropriate. That "bit by bit" thing was just a form of speech like "bitwise copy".
Regards
Sahir
mark aoki
When you pass an object by value if you haven't made provision for a copy constructor the compiler assumes a bit copy. That means the object is copied bit by bit without considering the (for lack of a better word) "semantics" of the object. Shallow copy and bitwise copy are the same thing.
Regards
Sahir