Results 1 to 3 of 3
  1. #1
    Class internal variable placement question.
    Bracer's Avatar
    Member Since
    Oct 07, 2009
    Location
    Singapore
    Posts
    14
    Class internal variable placement question.
    It seems I can do:

    ============================
    @interface MyClass:NSObject
    {

    }
    NSString* Message;
    @end
    ============================
    and
    ============================
    @interface MyClass:NSObject
    {
    NSString* Message;
    }
    @end
    ============================
    and Both will work.
    My question is...that being the case, what is the point of that "{}" ? What could be placed inside that cannot be place outside it ?

    Thanks

  2. #2
    Class internal variable placement question.
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    I don't know the answer, but you can't do this outside of the braces;
    Code:
    @public
    	NSString* message;
    Also note that Objective-C 2 seems to require the variable in the brackets for using the @property directive.

    This is valid;
    Code:
    @interface MyClass : NSObject {
    	NSString* message;
    }
    @property (retain) NSString* message;
    This is not valid;
    Code:
    @interface MyClass : NSObject {
    }
    	NSString* message;
    @property (retain) NSString* message;
    Perhaps it is related to the use of directives.


    Oddly, you can do this;
    Code:
    @interface MyClass : NSObject {
    	NSString* message;
    }
    NSString* message;
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

  3. #3
    Class internal variable placement question.
    Bracer's Avatar
    Member Since
    Oct 07, 2009
    Location
    Singapore
    Posts
    14
    Arh...interesting...
    Thank you xstep.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Upgrading internal HD question
    By Skiletsrage in forum Apple Notebooks
    Replies: 2
    Last Post: 12-01-2010, 03:11 PM
  2. Question about Internal HD of a Macbook
    By maddog345 in forum Apple Notebooks
    Replies: 1
    Last Post: 03-12-2009, 08:10 PM
  3. internal drive question
    By KoDorSean in forum Apple Notebooks
    Replies: 1
    Last Post: 12-04-2006, 08:07 PM
  4. Question: Desktop HDicon Placement
    By cabbas in forum Switcher Hangout
    Replies: 12
    Last Post: 06-04-2005, 03:37 PM
  5. Internal Bluetooth Question
    By miked18 in forum Apple Notebooks
    Replies: 2
    Last Post: 02-22-2005, 06:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •