After many years of using procedural programming languages, I am trying to learn Cocoa. Today I am reading the Apple document "The Objective-C Programming Language" dated 2009-10-19. On page 46 I read the following:
This is an example of what not to do: + (Rectangle *)rectangleOfColor:(NSColor *) color { self = [[Rectangle alloc] init]; // BAD [self setColor:color]; return [self autorelease]; } However, on page 49 I read the following: There are several constraints and conventions that apply to initializer methods that do not apply to other methods: . . . • You should assign self to the value returned by the initializer. This is because the initializer could return a different object than the original receiver. Could someone please explain this apparent contradiction? Lynn_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com