Objective C中的浅拷贝和深拷贝

其实和Java很类似的,浅拷贝要实现用NSCopying,深拷贝要实现NSMutableCopying,举个例子:

摘抄自:http://stackoverflow.com/questions/11329754/is-this-a-reasonable-pattern-for-implementing-nsmutablecopying

使用的时候:

 

 

Leave a Reply

Your email address will not be published.