home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20734 < prev    next >
Encoding:
Text File  |  1993-01-06  |  2.1 KB  |  50 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!mac4.jpl.nasa.gov!user
  3. From: sgrenander@NASAMAIL.JPL.NASA.GOV (Sven U. Grenander)
  4. Subject: Re: Duplicate Object in Think C?
  5. Message-ID: <sgrenander-050193152741@mac4.jpl.nasa.gov>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: news@elroy.jpl.nasa.gov (Usenet)
  8. Nntp-Posting-Host: mac4.jpl.nasa.gov
  9. Organization: Jet Propulsion Laboratory
  10. References: <white.724729120@sfu.ca> <1992Dec19.002858.299@physc1.byu.edu> <d!q2saf@rpi.edu> <1993Jan5.015329.15824@reed.edu> <noah-050193094549@noah.apple.com>
  11. Date: Tue, 5 Jan 1993 23:29:39 GMT
  12. Lines: 36
  13.  
  14. In article <noah-050193094549@noah.apple.com>, noah@apple.com (Noah Price)
  15. wrote:
  16. > In article <1993Jan5.015329.15824@reed.edu>, eric@reed.edu (eric) wrote:
  17. > > 
  18. > > Don't thinkC objects know what class they are, and can't you get this
  19. > > using CObject::GetClassName?  I don't think that you have to override
  20. > > this method, but then I can't recall ever having used it so . . .
  21. > Are you talking about copying objects?  I don't think you need to worry
  22. > about getting the class name.
  23. > The object itself will be copied by
  24. > newObject = anyObject->Copy();
  25. > The reason that I (and Brian Hall, I think) was suggesting you might need a
  26. > subclass is only if your object contains a reference to data that also
  27. > wants to be duplicated.
  28. > For example, if one of your instance variables is a handle, the Copy()
  29. > method will copy the handle (i.e., you'll have another pointer to the same
  30. > master pointer), but NOT the data the handle references.  You have to
  31. > decide for the particular situation if you just want a second handle to the
  32. > same data, or if you want a new copy of the data.
  33. > noah
  34. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. > noah@apple.com                                 Macintosh Hardware Design
  36. > ...!{sun,decwrl}!apple!noah   (not the opinions of) Apple Computer, Inc.
  37.  
  38. Not just handles. Poniters to dynamically allocated arrays would also cause
  39. problems.
  40.  
  41. -Sven
  42.