NSString *msgg = [NSString alloc];
NSLog(@" address that msgg is holding is %p ", msgg);
msgg = [msgg init];
NSLog(@" address that msgg is holding is %p ", msgg);
現在alloc指的是客觀的c去記憶者並劃出一個空間。這個空間的地址被保存在指針msgg中。noob here-目標C指針具有不同的地址?
該實例也在相同的空間中創建。所以我期待地址保持不變。 但我的輸出到控制檯是follows.Please注意地址不同
BasicObjC[3064:10b] address that msgg is holding is 0x103340
BasicObjC[3064:10b] address that msgg is holding is 0xa0289328
很好的解釋。萬分感謝! – user726102 2011-04-28 04:14:25
@ user726102請注意,這種行爲實際上是由類集羣使用的,但並不排除它們。 – 2011-04-28 04:17:00