本帖最后由 程序猿-2014 于 2014-4-13 00:34 编辑
#import <Foundation/Foundation.h> @interface Person : NSObject { int _money; int money; }
@property int money;
- (void)test; @end
@implementation Person - (void)setMoney: (int)money { self->money = money;
} - (void)test
{
NSLog(@"money=%d, _money=%d, self.money=%d", money, _money, self.money);
} @end int main() { Person *p = [Person new]; p.money = 2000; [p test]; return 0;
}
请问下这道题为什么输出的是 money=2000, _money=0, self.money=0 整不大明白......
|