Skip navigation.
 
mlRe: Overriding -copyWithZone: the right way
FROM : Bill Garrison
DATE : Fri Nov 05 22:42:59 2004

On Nov 5, 2004, at 1:52 PM, Jean-Olivier Lanctôt wrote:

> Is there an Apple document that tells us how to do it exactly?


I was just looking into this yesterday.  Check out the NSCopying 
protocol docs.

<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Protocols/NSCopying.html
>

DocoaBrowser also rocks for this: 
<http://www.iwascoding.com/DocoaBrowser/>


> On Fri, 5 Nov 2004 19:31:36 +0100, M. Uli Kusterer
> <witness.of.<email_removed>> wrote:

>> At 17:46 Uhr +0100 05.11.2004, Michael Becker wrote:
>>
>>

>>> - (id)copyWithZone:(NSZone *)zone {
>>>      PCShoppingCartCell *copy = [[ PCShoppingCartCell alloc]
>>> initImageCell:nil];
>>>      return copy;
>>> }



I implemented by copyWithZone: method using allocWithZone:, just to 
preserve the use of the zone argument.  I don't know if zones are used 
much any more, so maybe it's doesn't matter and a plain alloc: would 
suffice.

- Bill

Related mailsAuthorDate
mlOverriding -copyWithZone: the right way Michael Becker Nov 5, 17:46
mlRe: Overriding -copyWithZone: the right way Jonathon Mah Nov 5, 19:24
mlRe: Overriding -copyWithZone: the right way M. Uli Kusterer Nov 5, 19:31
mlRe: Overriding -copyWithZone: the right way Jean-Olivier Lanct… Nov 5, 19:52
mlRe: Overriding -copyWithZone: the right way Bill Garrison Nov 5, 22:42
mlRe: Overriding -copyWithZone: the right way Evan Schoenberg Nov 5, 22:50
mlRe: Overriding -copyWithZone: the right way M. Uli Kusterer Nov 5, 23:09
mlRe: Overriding -copyWithZone: the right way M. Uli Kusterer Nov 5, 23:24
mlRe: Overriding -copyWithZone: the right way Jean-Olivier Lanct… Nov 6, 00:27
mlRe: Overriding -copyWithZone: the right way Byron Wright Nov 6, 00:39
mlRe: Overriding -copyWithZone: the right way Jean-Olivier Lanct… Nov 6, 01:12
mlRe: Overriding -copyWithZone: the right way Steven Kramer Nov 6, 08:52
mlRe: Overriding -copyWithZone: the right way M. Uli Kusterer Nov 6, 16:50
mlRe: Overriding -copyWithZone: the right way The Karl Adam Nov 9, 02:04
mlRe: Overriding -copyWithZone: the right way The Karl Adam Nov 9, 02:24
mlRe: Overriding -copyWithZone: the right way M. Uli Kusterer Nov 9, 14:38