Re: Class variable?
Re: Class variable?
- Subject: Re: Class variable?
- From: Glen Low <email@hidden>
- Date: Sat, 7 Feb 2004 07:20:01 +0800
Is there a way in Cocoa to define a class variable that is shared
among all instances of that class, analogous to a +method? How?
You could try declaring a global static variable within your .m file
(not the .h header). Since it's static, it won't get seen by any other
.m file, only the code within the declaring .m file. The variable is
effectively shared among all instances
e.g.
static int shared = 0;
+ (int) incrementShared
{
return ++shared;
}
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.