New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Class internal variable placement question.


Post Reply New Thread Subscribe

 
Thread Tools
Bracer

 
Bracer's Avatar
 
Member Since: Oct 07, 2009
Location: Singapore
Posts: 14
Bracer is on a distinguished road

Bracer is offline
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
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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.
QUOTE Thanks
Bracer

 
Bracer's Avatar
 
Member Since: Oct 07, 2009
Location: Singapore
Posts: 14
Bracer is on a distinguished road

Bracer is offline
Arh...interesting...
Thank you xstep.
QUOTE Thanks

Post Reply New Thread Subscribe


« OSX Daemon using ObjectiveC and XCode | Terminal insert/delete characters problem »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
The question game! Sydrocentric Schweb's Lounge 28 06-13-2009 04:21 AM
Question: Desktop HDicon Placement cabbas Switcher Hangout 12 06-04-2005 03:37 PM
Internal Bluetooth Question miked18 Apple Notebooks 2 02-22-2005 06:20 PM
Internal DVD burner question mosschops Other Hardware and Peripherals 2 01-29-2005 07:03 AM
Internal DVD Drive Question... SEKO-SAN! Apple Desktops 0 03-03-2004 12:23 PM

All times are GMT -4. The time now is 11:05 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?