Re: [algogeeks] Re: deep vas shallow

2011-10-02 Thread rahul vatsa
ignore the prev mail, send button hd got clicked while i was typing .. :P shallow copy > - > > class MyString { > > char *str; > public: > MyString(char *); > //MyString & operator=(const MyString & t); > }; > > MyString :: MyString(char *s) > { > int len = strlen(s); > str =

Re: [algogeeks] Re: deep vas shallow

2011-10-02 Thread rahul vatsa
shallow copy - class MyString { char *str; public: MyString(char *); //MyString & operator=(const MyString & t); }; MyString :: MyString(char *) { } MyString a("rahul"); MyString b; b = a; the default = operator does a bitwise copy, so if we don't overload the default behavio

Re: [algogeeks] Re: deep vas shallow

2011-10-01 Thread rahul sharma
means if i use like main() { int *ptr; abc(ptr); } abc(int *a) { } this is shallow copy m i ryt??? if yes thne tell xample of deep shallow..otherwise give me examples regarding c++cozxamples clear everythng On Sun, Oct 2, 2011 at 11:00 AM, megha agrawal wrote: > One function passes a point

Re: [algogeeks] Re: deep vas shallow

2011-10-01 Thread megha agrawal
One function passes a pointer to the value of interest to another function. Both functions can access the value of interest, but the value of interest itself is not copied. This communication is called shallow. The alternative where a complete copy is made and sent is known as a "deep" copy. On S

Re: [algogeeks] Re: deep vas shallow

2011-10-01 Thread rahul sharma
plz give any c++ xample to xplain bit more On Sat, Oct 1, 2011 at 6:59 PM, Bejoy kalikotay(sikkimesechora) < bijaykaliko...@gmail.com> wrote: > A shallow copy of an object copies all of the member field values. > This works well if the fields are values, but may not be what you want > for fie