关闭

dic 深度复制???

519人阅读 评论(0) 收藏 举报
    NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:
                         [NSMutableString stringWithString:@"firstValue"],@"first",
                         [NSMutableString stringWithString:@"secondValue"],@"second",                          
                         [NSMutableString stringWithString:@"thirdValue"],@"third",    nil                      
                         ];
    
    NSDictionary *conDic = [dic copy];
    
    NSMutableDictionary *mulDic = [dic copy];
    
    NSLog(@"conDic:%@",conDic);
    NSLog(@"mulDic:%@",mulDic);    
    
    [[dic valueForKey:@"first"] appendString:@"append"];
    
    NSLog(@"conDic:%@",conDic);

    NSLog(@"mulDic:%@",mulDic);   


2012-03-31 15:55:12.454 DictionaryTest[4900:207] conDic:{
    first = firstValue;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.455 DictionaryTest[4900:207] mulDic:{
    first = firstValue;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.456 DictionaryTest[4900:207] conDic:{
    first = firstValueappend;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.456 DictionaryTest[4900:207] mulDic:{
    first = firstValueappend;
    second = secondValue;
    third = thirdValue;
}



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:62804次
    • 积分:1154
    • 等级:
    • 排名:千里之外
    • 原创:49篇
    • 转载:37篇
    • 译文:2篇
    • 评论:0条