Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iFaisal

macrumors newbie
Original poster
Apr 17, 2011
4
0

hello everyone ,

what is the different between set/get function and @property/@synthesize ?

is it just syntax code or not ? and what does mean ?
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
hello everyone ,

what is the different between set/get function and @property/@synthesize ?

is it just syntax code or not ? and what does mean ?

The Objective-C 2.0 language manual on Apple's web site will answer all these questions. And playing around with styles like you did is _very_ impolite.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
At first we had to code our own getters and setters. There was no concept of a property in Objective-C 1.0, except by the convention that if a class had a method x and a method setX: then it could have been said to have property x.

Then Apple created Objective-C 2.0 and it introduced the @property and @synthesise directives, as well as the dot notation. And the number of getters and setters we had to write was reduced to near zero. And our getters and setters become correct in the face of concurrency (assuming no nonatomic) which set us up well for the days of multicore CPUs and GCD.

And the people programming in the land of Apple were happy. (Well generally, some have some valid objections to dot notation).

So yeah, it's just syntax. But I'd highly recommend you use it, unless you have strong reasons not to.
 

iFaisal

macrumors newbie
Original poster
Apr 17, 2011
4
0
thank you everyone ... I'm understanding now what is the different . :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.