Re: ObjC static member variable
Re: ObjC static member variable
- Subject: Re: ObjC static member variable
- From: Michael Vannorsdel <email@hidden>
- Date: Thu, 10 Apr 2008 13:39:16 -0600
You'll need to move the declaration outside the interface. You can
stick it in the .m file for that class like you can with C/C++.
On Apr 10, 2008, at 1:29 PM, vance wrote:
Does ObjC supports Static Member Variable, and if so, how do you set
it?
The getter function gets a compile time error. In C++ we do
MyObject::staticObject to return the static member variable but I am
not sure how is that done in ObjC
Ex:
@interface MyObject : NSObject {
static BaseObject *staticObject;
}
- (BaseObject *)staticObject
{
return staticObject;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden