Re: Initializing an Array
Re: Initializing an Array
- Subject: Re: Initializing an Array
- From: email@hidden
- Date: Tue, 22 Jan 2002 13:45:55 -0800
Object-Oriented Programming and the Objective-C Language
file://localhost/Developer/Documentation/Cocoa/ObjectiveC/3CoreObjC/How_Messaging_Works.
html
For some tasks, each class in the inheritance hierarchy can implement a
method that does part of the job and pass the message on to super for
the rest. The init method, which initializes a newly allocated instance,
is designed to work like this. Each init method has responsibility for
initializing the instance variables defined in its class. But before
doing so, it sends an init message to super to have the classes it
inherits from initialize their instance variables. Each version of init
follows this same procedure, so classes initialize their instance
variables in the order of inheritance:
- (id)init
{
[super init];
. . .
}
On Tuesday, January 22, 2002, at 01:30 PM, Jeff Galyan wrote:
>
Interesting... That means Apple's docs are wrong (or at least the
>
version I
>
have is -- "Inside Cocoa: Object-Oriented Programming and the
>
Objective-C
>
Language").
>
>
Anyway, the way I fixed the crash was to remove the instance vars and
>
the
>
-initWithString: method and make the caller pass in a pointer to
>
NSString
>
with each message.
>
>
--Jeff