• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how do I put an object in a dictionary, change the object but leave the dict untouched?
[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?


  • Subject: Re: how do I put an object in a dictionary, change the object but leave the dict untouched?
  • From: Cameron Hayne <email@hidden>
  • Date: Sat, 24 Jun 2006 16:12:12 -0400


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: This email sent to email@hidden
  • Follow-Ups:
    • [SOLVED] how do I put an object in a dictionary, change the object but leave the dict untouched?
      • From: "Alan Smith" <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>)

  • Prev by Date: Re: top level objects and NSWindowController
  • Next by Date: Helper Tool on FireWire
  • Previous by thread: Re: how do I put an object in a dictionary, change the object but leave the dict untouched?
  • Next by thread: [SOLVED] how do I put an object in a dictionary, change the object but leave the dict untouched?
  • Index(es):
    • Date
    • Thread