iOSInterviewQuestions
iOSInterviewQuestions copied to clipboard
第6题 上述代码写出来的类与下面这种写法等效:
@property NSString *firstName; 以上这种定义方式应该包含的内容是:成员变量+setter方法+getter方法; 而你说与下面的等价:
- (NSString *)firstName;
- (void)setFirstName:(NSString *)firstName; 以上就包含:setter方法+getter方法,而没有定义成员变量。 不知是不是这样理解的?请多多指教,谢谢!
我觉得应该是博主写漏了,@property是会自动合成实例变量的,相当于系统自动帮你写了一句: @synthesize firstName = _firstName
@VinlorJiang