• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Shallow & Deep Objects

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Few of my friends were using the terms Shallow & Deep Objects. Can somebody tell what it means? Is it something new or just a differnt name for some concept?
Thanks,
Tom
[ April 16, 2002: Message edited by: Tom Keith ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you mean a shallow vs a deep copy or clone?
If you clone something - say an array, there are two ways that you can do it. You can create an identical array where each of the elements of the arrays point to the same objects. This is a shallow copy.
array1 = [ obj1 ] [ obj2 ] [ obj3 ] copies to
array2 = [ obj1 ] [ obj2 ] [ obj3 ]
Both array1 and array2 have elements referencing the SAME objects.
In a deep clone not only do you create a new array object, you also create copies of each of the objects that are referenced by the array.
array1 = [ obj1 ] [ obj2 ] [ obj3 ] copies to
array2 = [ CopyOfObj1 ] [ CopyOfObj2 ] [ CopyOfObj3 ]
This is a deep copy.
Is this what you are talking about?
[ April 16, 2002: Message edited by: Cindy Glass ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic