On 18 May 08, at 22:06, Brett Powley wrote:
MyAppDelgate *ad = [NSApp delegate];
then do something with [ad myMutableArray]

Incorrect. You don't get accessors for instance variables automatically like that.

To the original poster, there are three approaches you can go with here.

One is to set the variables as @public in the ApplicationDelegate, then access them as applicationDelegate->theArray. This breaks encapsulation, but it works.

Another approach is to write accessor methods on the ApplicationDelegate to return the arrays and use those. This requires some extra code.

Finally, if you're targeting Leopard, you can use properties. These can be put together without any extra code, and they don't break OO like @public variables do.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to