title: mutableCopyWithZone, copy NSMutableArray?
body: <p>I a trying to make a mutableCopy of a planet object that contains 5 instance variables (one of them being an NSMutableArray of string literals. My problem is that I am unsure how to set the newPlanet>data to a copy of self>data, does that make sense?</p>
  
  <pre><code>-(id) mutableCopyWithZone: (NSZone *) zone {
      Planet *newPlanet = [[Planet allocWithZone:zone] init];
      NSLog(@"_mutableCopy: %@", [newPlanet self]);
      [newPlanet setName:name];
      [newPlanet setType:type];
      [newPlanet setMass:mass];
      [newPlanet setIndex:index];
  
      // NSMutableArray *data; HOW TO: newPlanet&gt;data = self&gt;data? 
  
      return(newPlanet);
  }
  </code></pre>
  
  <h1>EDIT_001:</h1>
  
  <p>Based on the comments by Chuck &amp; bbum I updated my method and added the following ...</p>
  
  <pre><code>@property(retain) NSMutableArray *data;
  @synthesize data;
  </code></pre>
  
  <p>.</p>
  
  <pre><code>-(id) mutableCopyWithZone: (NSZone *) zone {
      Planet *newPlanet = [[Planet allocWithZone:zone] init];
      NSLog(@"_mutableCopy: %@", [newPlanet self]);
      [newPlanet setName:name];
      [newPlanet setType:type];
      [newPlanet setMass:mass];
      [newPlanet setIndex:index];
  
      NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone];
      [newPlanet setData: copiedArray];
      [copiedArray release];
  
      return(newPlanet);
  }
  </code></pre>
  
  <p>much appreciated</p>
  
  <p>gary</p>