Re: Array question, Obj-C
Re: Array question, Obj-C
- Subject: Re: Array question, Obj-C
- From: Andreas Mayer <email@hidden>
- Date: Sat, 25 May 2002 03:04:02 +0200
Am Samstag den, 25. Mai 2002, um 02:06, schrieb Hisaoki Nishida:
My question is, is VCellWallArray being added the correct xCount value
every time the loop is executed?
Yes.
Is it just adding a pointer and destroying the link everytime a new
value is assigned to wrapped?
Yes.
wrapped = [NSNumber numberWithInt:xCount];
NSNumber will create a new object, autorelease it and return it, so you
can assign it to 'wrapped'.
[VCellWallArray addObject:wrapped];
VCellWallArray will retain the object, 'wrapped' points to, so that it's
not deallocated while in use.
Whenever VCellWallArray gets deallocated, it will release all objects
stored within.
That is, if I did understand Obj-C memory management correctly. :)
BTW: You do, of course, not need a temporary variable:
[VCellWallArray addObject:[NSNumber numberWithInt:xCount]];
bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.