Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
December 16, 2017, 09:21:15 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: @property syntax question?  (Read 1370 times)
Semaj
Newbie
*
Posts: 8


« on: February 11, 2011, 12:26:20 PM »

What are the rules for declaring data types in the @property statement?

For example, why does the following syntax work

@property int numerator, denominator;

While this syntax throws an error

@property int numerator, int denominator;

What if you are using more than one data type (ie int and string)?
Logged
scokar
Newbie
*
Posts: 10


« Reply #1 on: February 11, 2011, 02:03:27 PM »

I think you can use the following for syntehsizing setter/getter variables of different types:


Code: (Objective-C)
@interface myClass: NSObject
{
     int myInt;
     int yourInt;
     NSString * myString;
{
@property int myInt, yourInt;
@property NSString *myString;

@end
Logged
Semaj
Newbie
*
Posts: 8


« Reply #2 on: February 21, 2011, 01:00:26 PM »

Does anyone know the syntax rules for @property?  Why does the following statement generate an error?

@property int numerator, int denominator;
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114



« Reply #3 on: February 21, 2011, 07:15:05 PM »

The type of the property is only listed once.  You need to write it like this:

Code: (Objective-C)
@property int numerator, denominator;

Cheers,

Steve Kochan
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.