Thursday, October 9, 2008 [Tweets]

The How and Why of Cocoa Initializers

Mike Ash:

This is why the standard initializer pattern is the only one that works. Cocoa classes can and do deallocate the original instance, then allocate a new instance of the same class (or a subclass) and return it from their initializers. This is admittedly rare, but it is legal and it does happen. And that, in a nutshell, is why the standard Apple initializer pattern is the only correct way.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment