home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18439 < prev    next >
Encoding:
Text File  |  1992-12-27  |  1.8 KB  |  45 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mole-end!mat
  3. From: mat@mole-end.matawan.nj.us
  4. Subject: Re: Make a deep copy!
  5. Message-ID: <1992Dec27.024000.26981@mole-end.matawan.nj.us>
  6. Summary: Deep .vs. Shallow: the Shallow and the Deep of it ...
  7. Organization: :
  8. References: <kwong.724744711@morgan> <1992Dec23.210224.566@microsoft.com>
  9. Distribution: usa
  10. Date: Sun, 27 Dec 1992 02:40:00 GMT
  11. Lines: 32
  12.  
  13. In article <1992Dec23.210224.566@microsoft.com>, pauljo@microsoft.com (Paul Johns) writes:
  14.  
  15. > Specifically, you need a copy constructor which
  16. > copies the data pointed to by the pointer in the
  17. > object.  (You should copy both the actual data
  18. > and the array of pointers--I think you missed
  19. > copying the array of pointers in your assignment
  20. > operator.)
  21.  
  22. > Also, read a good C++ text for other pointers.
  23.  
  24. It seems to me that the whole question of Deep .vs. Shallow copy is
  25. misdirected.  A program is--or should be--a model of something.  A
  26. model is an abstraction expressed in a representation.  That a copy
  27. is deep or shallow describes a technique of representation.  It is
  28. pointless to discuss it without reference to the thing represented.
  29.  
  30. Deep copy is necessary when you must copy not only one object (small `o'
  31. object) but also objects related to it.  It may be that you must copy
  32. all objects related to it; it may be that you must copy only some objects
  33. related to it.  To know what must be copied, you must understand the
  34. existential relationships in which the object participates, both their
  35. meaning and their requisite cardinality.
  36.  
  37. And when you understand the issue on that level, Deep and Shallow become
  38. just two possibilities of many--but the correct possibility reveals itself
  39. so that you don't have to go asking the question.
  40. -- 
  41.  (This man's opinions are his own.)
  42.  From mole-end                Mark Terribile
  43.  
  44.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  45.