开发者

declare @property with different name?

开发者 https://www.devze.com 2022-12-16 05:17 出处:网络
I was just working through a iPhone book and I noticed a comment that stated... If you declare a property with a

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

精彩评论

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