+initialize is called only the first time a class is instantiated; it can be 
called again if a derived class does not implement it.

- Gary L. Wade (Sent from my iPhone)

On Jul 24, 2011, at 12:43 PM, Gabriel Roth <gabe.r...@gmail.com> wrote:

> On Sun, Jul 24, 2011 at 3:33 PM, Ken Tozier <kentoz...@comcast.net> wrote:
>> I wrote a class that stores data common to all instances in an, init file, 
>> but when I create new instances, + (void) initialize isn't getting called.
> 
> I can't tell for sure from your email, but it seems like you might be
> expecting initialize to be called whenever you create a new instance
> of your class.
> 
>> From the NSObject documentation:
> "The runtime sends initialize to each class in a program exactly one
> time just before the class, or any class that inherits from it, is
> sent its first message from within the program."
> 
> So creating a new instance won't trigger an initialize message unless
> it's the very first message sent to your class.
> 
> Sorry if I've misunderstood.
> 
> gr.
_______________________________________________

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

Reply via email to