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

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!usc!howland.reston.ans.net!wupost!csus.edu!netcom.com!mspace
  3. From: mspace@netcom.com (Brian Hall)
  4. Subject: Re: Duplicate Object in Think C?
  5. Message-ID: <1993Jan6.084330.7697@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. 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>
  8. Date: Wed, 6 Jan 1993 08:43:30 GMT
  9. Lines: 24
  10.  
  11. noah@apple.com (Noah Price) writes:
  12. >The reason that I (and Brian Hall, I think) was suggesting you might need a
  13. >subclass is only if your object contains a reference to data that also
  14. >wants to be duplicated.
  15.  
  16. >For example, if one of your instance variables is a handle, the Copy()
  17. >method will copy the handle (i.e., you'll have another pointer to the same
  18. >master pointer), but NOT the data the handle references.  You have to
  19. >decide for the particular situation if you just want a second handle to the
  20. >same data, or if you want a new copy of the data.
  21.  
  22. You would want to copy the dat itself in case you end up disposing the
  23. object.  If you have two copies of an object (that have a handle as
  24. instance data) then disposing the first object will leave a "dangling
  25. handle" in the second object - the handle will not be NULL, but it won't
  26. be pointing to anything you would want it to!
  27.  
  28. -- 
  29.  
  30.  \ | /   | Brian Hall                 mspace@netcom.com
  31.  - : -   | Mark/Space Softworks       Applelink: markspace
  32.   /|\    |                            America Online: MarkSpace
  33.  |-+-|   |
  34. /-\|/-\  | Visit me at the Apple SSW and/or Ex Machina booth. Just because.
  35.