开发者

Can I add the same object to two different arrays?

开发者 https://www.devze.com 2023-01-24 09:53 出处:网络
Is this valid: NSObject anObject = [[NSObject alloc] init]; [array1 addObject:anObject]; [array2 addObject:anObject];

Is this valid:

 NSObject anObject = [[NSObject alloc] init];
 [array1 addObject:anObject];
 [array2 addObject:anObject];

My money is on yes开发者_高级运维, since I'm only adding references to the same object, or am I wrong here?


Yes :) Dont forget to make it a mutable array

0

精彩评论

暂无评论...
验证码 换一张
取 消