I use this code to copy and instance of my class
//Create the copy and pass it onto edit controller PoolFacility *poolCopy = [self.thePoolFacility copy]; self.childController.thePoolFacilityCopy = poolCopy; [poolCopy release];
Now when I view the variables in the debugger, how come some of the class’ fields have the same memory address? Shouldn’t they be independent? According to Apple
The NSCopying protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.
The two instances are poolCopy & the original thePoolFacility

My class copy method looks like this:
- (id)copyWithZone:(NSZone *)zone { PoolFacility *copy = [[[self class] allocWithZone:zone]init]; copy.name = [self.name copy]; copy.type = [self.type copy]; copy.phoneNumber = [self.phoneNumber copy]; //make sure I get proper copies of my dictionaries copy.address = [self.address mutableCopy]; copy.webAddress = [self.webAddress copy]; copy.prices = [self.prices mutableCopy]; copy.pools = [self.pools mutableCopy]; return copy; }
Immutable classes such as NSString (but not NSMutableString) don’t need to offer an actual copy because they cannot be altered. My guess is that these classes are simply performing an optimization which shouldn’t affect the copier’s behavior.