Go Back   TheAppleBlog Forums > Apple/Mac > Development
Register Social Groups iSpy Members List Search Today's Posts Mark Forums Read FAQ

Development XCode, Cocoa, and all other development

Reply
 
LinkBack Thread Tools Search this Thread
03-02-2009   #1 (permalink)
Operator
 
Join Date: Mar 2009
Location: NZ
Posts: 2
Chirone has disabled reputation
back in the old days you would be able to go myClass.MY_CONSTANT and that would return to you the value of MY_CONSTANT which is specific to myClass

in objective c if i go #define MY_CONSTANT i can't access it outside of the class
i can't put anything in the @interface part because it just throws compile errors
Code:
const int MY_CONSTANT 0;
static const int MY_CONSTANT = 0;
static int MY_CONSTANT = 0;
and everything else i can think of throws an error

is it possible in objective c to just go myClass.MY_CONSTANT? and if so then how am i meant to declare MY_CONSTANT in myClass? i don't want to have to make an instance of myClass just to access it because that's just silly when its the same throughout all classes


also, on the issue of enums
Code:
typedef enum {
CONSTANT_ZERO = 0,
CONSTANT_ONE = 1
} someName
in the class i can just type CONSTANT_ZERO and it gives me the value (which is understandable)
but the someName is pretty much redundant as its never used in the class and no one outside the class can use it as well.
so there isn't really a point to enums in obj c is there?
Chirone is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 01:40 PM.




Powered by vBulletin
© 2004-2009

SEO by vBSEO 3.2.0