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