Implementing NSCopying in Subclass of Subclass
问题 I have a small class hierarchy that I'm having trouble implementing copyWithZone: for. I've read the NSCopying documentation, and I can't find the correct answer. Take two classes: Shape and Square . Square is defined as: @interface Square : Shape No surprise there. Each class has one property, Shape has a "sides" int, and Square has a "width" int. The copyWithZone: methods are seen below: Shape - (id)copyWithZone:(NSZone *)zone { Shape *s = [[Shape alloc] init]; s.sides = self.sides; return