• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Initializing an Array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initializing an Array


  • Subject: Re: Initializing an Array
  • From: Bob Savage <email@hidden>
  • Date: Fri, 25 Jan 2002 18:49:36 -0600

Can somebody provide a more precise citation for the problem in the
documentation? I haven't found the problem to which some people are
referring. For example what page in the PDF?

Bob

on 1/24/02 6:57 PM, jgo at email@hidden wrote:

>> I looked back at my copy of the book and it definitely says
>> (page 86 in my copy, "NeXT Developer's Library: Object-Oriented
>> Programming and the Objective-C Language"):
>>
>> [super init]
>>
>> NOT
>>
>> [[super alloc] init]
>>
>> If your copy has an error like this, could you please send the Apple
>> documentation team a bug report with the page number on which the
>> error occurs.
>
> I'm getting slightly more confused every time I get to another
> message in this thread.
>
> Presumably, before the init is executed, the alloc for self has
> already done its thing, a la Fred * george = [[Fred alloc] init];
> where by the time the init happens, Fred has already allocated
> its memory.
>
> That's fine as far as it goes. But in the book (PDF), the example
> is lacking in context (no surprise), and later paragraphs muddy the
> waters.
>
> So, where are we? We've allocated self, but we need to do the
> super init message to set up the ivars that super takes care of.
> if (...)
> {
> [super init];
> }

if ([super init]) {
// initalize our subclass' ivars
}
return self;

Bob


  • Prev by Date: Re: How to defer NSDocument:writeToFile:ofType ?
  • Next by Date: Milliseconds Function?
  • Previous by thread: Re: Initializing an Array
  • Next by thread: Re: Initializing an Array
  • Index(es):
    • Date
    • Thread