ios中 所有带NSMutable的数据类型 copy 方法得到的都是浅copy不可变的数据类型
否则用mutableCopy
int main(int argc, char *argv[]) {
@autoreleasepool {
NSMutableArray *original = [NSMutableArray arrayWithObjects:@"a", @"b",nil];
NSMutableArray *shallowCopy = [original copy]; //得到的是不可变的NSArray
//NSMutableArray *shallowCopy = [original mutableCopy];
NSMutableArray *deepCopy = [[NSMutableArray alloc] initWithArray:original copyItems:YES];
[shallowCopy removeObjectAtIndex:1];
NSLog(@"%@ %@",shallowCopy,deepCopy);
}
}