#import <Foundation/Foundation.h>
@interface Person : NSObject
@property (nonatomic, copy) NSString *copiedString;
@property (nonatomic) NSString *name;
@property (nonatomic,strong) NSString *name1;
@property (nonatomic,weak) NSString *name2;
@property (nonatomic,retain) NSString *name3;
@property (nonatomic,assign) NSString *name4;
@property (nonatomic) NSArray *arr;
@property (nonatomic,strong) NSArray *arr1;
@property (nonatomic,weak) NSArray *arr2;
@property (nonatomic,retain) NSArray *arr3;
@property (nonatomic,assign) NSArray *arr4;
@end
#import <Foundation/Foundation.h>
#import "Person.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
Person *per = [[Person alloc] init];
per.name = @"zhangsan";
per.copiedString = @"copiedString";
per.arr = @[@1,@2,@3];
__strong NSArray *strongArr = per.arr;
per.arr = nil;
NSLog(@"strongArr:%@",strongArr);
__weak NSArray *weakArr = strongArr;
strongArr = nil;
NSLog(@"weakArr:%@",weakArr);
}
return 0;
}
2016-06-14 21:22:44.794 TEST123[11421:146417] otherArr:(
1,
2,
3
)
2016-06-14 21:22:44.796 TEST123[11421:146417] strongArr:(null)
Program ended with exit code: 0