Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do I put an object in a dictionary, change the object but leave the dict untouched?




On 24-Jun-06, at 3:20 PM, Alan Smith wrote:

Each entry of dict1 has a dict2 in it.
[...]
[dict2 setObject: @"some object" forKey: @"object"];
[dict1 setObject: dict2 forKey: @"firstEntry"];

[dict2 setObject: @"another object" forKey: @"object"];
[dict1 setObject: dict2 forKey: @"secondEntry"];

As Ashley Clark has already pointed out, according to your code,
there is only one dict2 object and it is referred to in all dict1 entries.
So instead of "Each entry of dict1 has a dict2 in it", the situation is really "Each entry of dict1 has the dict2 in it."


--
Cameron Hayne
email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >how do I put an object in a dictionary, change the object but leave the dict untouched? (From: "Alan Smith" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.