Re: define class variable
Re: define class variable
- Subject: Re: define class variable
- From: j o a r <email@hidden>
- Date: Thu, 1 Aug 2002 11:39:19 +0200
Something like this:
@implementation MyClass
static NSString *myGlobalString = nil;
+ (void) setResult:(NSString *) newResult
{
[myGlobalString autorelease];
myGlobalString = [newResult retain];
}
+ (NSString *) getResult
{
return myGlobalString;
}
@end
The space within brackets in the @interface declaration of a class is
reserved for instance variables, not class variables.
j o a r
On Thursday, August 1, 2002, at 11:35 , Chong Hiu Pun wrote:
How to define class variable which can be access by class method ( e.g
+(NSString*)GetResult; )
Thanks.
ps: I defined under
@interface my_class_name : NSObject
{
....
NSString strResult; //define here, but receive compiler warning
...
}
_______________________________________________
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.
_______________________________________________
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.