Re: ObjC static member variable

2008-04-10 Thread Chris Hanson
On Apr 10, 2008, at 12:42 PM, vance wrote: Yes that works but then it becomes a global variable. I was wondering if ObjC can handle static member variables. If not I will have to hack it up and declare the variable outside of the class A C++ static member variable is a global variable too, i

Re: ObjC static member variable

2008-04-10 Thread Andy Lee
On Apr 10, 2008, at 4:08 PM, Scott Ribe wrote: Yes that works but then it becomes a global variable. Not when it's declared static. As in plain C, static variables are at file scope. If you really want to access it via instances of the Objective-C class (or the class itself), you'll just

Re: ObjC static member variable

2008-04-10 Thread Scott Ribe
> Yes that works but then it becomes a global variable. Not when it's declared static. As in plain C, static variables are at file scope. If you really want to access it via instances of the Objective-C class (or the class itself), you'll just have to implement an appropriate method to return it,

Re: ObjC static member variable

2008-04-10 Thread j o a r
On Apr 10, 2008, at 12:48 PM, j o a r wrote: No, ObjC doesn't have any support for static member variables. Btw. For ObjC I think it would be more appropriate to call them "class variables". j o a r ___ Cocoa-dev mailing list (Cocoa-dev@list

Re: ObjC static member variable

2008-04-10 Thread Michael Vannorsdel
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 er

Re: ObjC static member variable

2008-04-10 Thread j o a r
On Apr 10, 2008, at 12:42 PM, vance wrote: Yes that works but then it becomes a global variable. It's static, so it's local to the module being compiled. I was wondering if ObjC can handle static member variables. If not I will have to hack it up and declare the variable outside of the cl

Re: ObjC static member variable

2008-04-10 Thread Randall Meadows
On Apr 10, 2008, at 1:42 PM, vance wrote: Yes that works but then it becomes a global variable. I was wondering if ObjC can handle static member variables. If not I will have to hack it up and declare the variable outside of the class Yep, that was the answer I got from several sources when

Re: ObjC static member variable

2008-04-10 Thread vance
: cocoa-dev Subject: ObjC static member variable 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

RE: ObjC static member variable

2008-04-10 Thread Rama Krishna
: Thursday, April 10, 2008 3:30 PM To: cocoa-dev Subject: ObjC static member variable 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

ObjC static member variable

2008-04-10 Thread vance
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 { s