开发者

declare @property with different name?

I was just working through a iPhone book and I noticed a comment that stated...

If you declare a property with a different name than its underlying开发者_Python百科 instance varaible (which can be done with the @synthesize directive)

Can anyone explain how the above quote might work, I am just curious as all references to @property / @synthesize always look like my code below.

@interface Planet : NSObject {
    NSString *planetName;
}

@property(copy) NSString *planetName;
...
@synthesize planetName;

gary


I would presume the book would go on to explain, but i would look like this:

@interface Planet : NSObject {
    NSString *name;
}

@property(copy) NSString *planetName;
...
@synthesize planetName = name;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜