NSArray *arr1 = [[NSArray alloc] initWithObjects:@"a",@"b", nil];
// 浅拷贝
NSArray *arr2 = [arr1 copy];
// 深拷贝
NSMutableArray *arr3 = [arr1 mutableCopy];
// 运行结果: 0x60000003b280,0x60000003b280,0x600000245400
NSLog(@"%p,%p,%p",arr1,arr2,arr3);
[arr3 release];
[arr2 release];
[arr1 release];
// 可变数组
NSMutableArray *arr1 = [[NSMutableArray alloc] initWithObjects:@"a",@"b", nil];
// 深拷贝
NSArray *arr2 = [arr1 copy];
// 深拷贝
NSMutableArray *arr3 = [arr1 mutableCopy];
// 运行结果: 0x60400005ee70,0x60400003e3e0,0x60000024e4f0
NSLog(@"%p,%p,%p",arr1,arr2,arr3);
[arr3 release];
[arr2 release];
[arr1 release];
// 不可变数组
NSDictionary *dict1 = [[NSDictionary alloc] initWithObjectsAndKeys:@"jack",@"name", nil];
// 浅拷贝
NSDictionary *dict2 = [dict1 copy];
// 深拷贝
NSMutableDictionary *dict3 = [dict1 mutableCopy];
// 运行结果: 0x604000220480,0x604000220480,0x60400003fc60
NSLog(@"%p,%p,%p",dict1,dict2,dict3);
[dict3 release];
[dict2 release];
[dict1 release];
// 可变数组
NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"jack",@"name", nil];
// 深拷贝
NSDictionary *dict2 = [dict1 copy];
// 深拷贝
NSMutableDictionary *dict3 = [dict1 mutableCopy];
// 运行结果: 0x60000003b960,0x60000003b940,0x60000003b880
NSLog(@"%p,%p,%p",dict1,dict2,dict3);
[dict3 release];
[dict2 release];
[dict1 release];