title: How to implement properly mutableCopyWithZone and copyWithZone
body: <p>I read others few topics about it, but still I'm lost.</p>
  
  <p>I want to create 2 kind of objects, one immutable with only "readonly" properties, and one mutable with only "readwrite" properties.</p>
  
  <p>Lets call them EXCar and EXMutableCar.</p>
  
  <p>EXCar is subclass of NSObject, and EXMutableCar is Subclass of EXCar.</p>
  
  <p>ExCar will have in its interface</p>
  
  <pre><code>@property (nonatomic, strong, readonly) NSString *name;
  </code></pre>
  
  <p>EXMutableCar will have in its interface</p>
  
  <pre><code>@property (nonatomic, strong) NSString *name;
  </code></pre>
  
  <p>So I "open" properties of EXCar when I use its subclasse EXMutableCar. And then it's mutable.
  The problem is to copy properly between them.</p>
  
  <p>I implemented mutableCopyWithZone in EXCar :</p>
  
  <pre><code>- (id)mutableCopyWithZone:(NSZone *)zone {
      EXMutableCar *mutableCopy = [[EXMutableCar allocWithZone:zone] init];
      mutableCopy.name = _name;
  
      return mutableCopy;
  }
  </code></pre>
  
  <p><strong>First question, is it the good way to do it ? (I want swallow copy)</strong></p>
  
  <p>The problem is with copyWithZone.
  Since the properties of EXCar are readonly I cannot create neither in EXCar, neither in EXMutableCar a new instance of EXCar and fill its properties like this :</p>
  
  <pre><code>- (id)copyWithZone:(NSZone *)zone {
      EXCar *copy = [[EXCar allocWithZone:zone] init];
      copy.name = _name; // This can't work...
  
      return copy;
  }
  </code></pre>
  
  <p>And I don't really want to do an "init" method with 15 properties to pass in (for sure, EXCar is an example, real classes are full of many properties). And normally they are initiated from JSON message from server, so they don't need a complicate init method.</p>
  
  <p><strong>Second question is so, how to do a copyWithZone that keep my class immutable ?</strong></p>
  
  <p>Thanks for your help :)</p>