A 101 question
Let's say i'm making database of cars
and each car object is defined as:
#import <UIKit/UIKit.h>
@interface Car:NSObject{
NSString *name;
}
@property(nonatomic, retain) NSString *name;
Why is it @property(nonatomic, retain) NSString *name;
and not @property(nonatomic, assign) NSString *name;
?
I understand that assign
will not increment the reference counter as retain
will do. But why use retain
, since name
is a member of the todo
object the scope of it is to itself.
No other external function will modify it either.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…