可能重複:
How does an underscore in front of a variable in a cocoa objective-c class work?財產申報的幫助
我所看到的,他們使用下面的編碼風格財產申報網上有許多例子:
@interface Book : NSObject
{
NSString *_title;
}
@property (nonatomic, retain) NSString *title;
@end
在實施:
@implementation Book
@synthesize title = _title;
@end
問題是我們爲什麼使用下劃線?