On Tue, Jul 1, 2008 at 6:49 PM, Jonathan Hess <[EMAIL PROTECTED]> wrote:
> Han Daniel -
>
> You can use a global variable just like you would in C:

Yes, but...

> static Foo *bar = nil;

That's not a global. Static vars are file scoped. :-)

In Foo.m:

    Foo *globalFoo = nil;

In Foo.h, somewhere outside the class @interface:

    extern Foo *globalFoo;

That said, I think you have the right idea, with a file-scoped static
var and a +sharedFoo method being the only way to get at it. I'm just
saying, that's not a global variable. :-)

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

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