• 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: Wed, 30 Jan 2002 00:37:58 -0600

on 1/29/02 10:31 PM, jgo wrote:
>
> The Italians have an expression having to do with the
> need for certain persons to eat a lot of bread.

I assure you I eat my fair share of it. :^/

> Yes I most certainly do understand what classes are, what
> self is and what super is.

Good. Because the code you posted earlier led me to believe otherwise :P

> // only if self is not nil do we do our subclass' init
> x = [[SomeOtherClassWhichWasIntroducedForSomeUnknownReason
> alloc] init]; // for example
>
> // but wait, we are in the init for ThisClass, already
> // so we need to init self's iVars...
> // unless you meant "x" to be self's iVar?
> }

Exactly, x is an example of an ivar -- which is the whole purpose of the if
block. Your example showed a test for nil which led conditionally to another
attempt to create an instance of the same class inside of a failed init
method. which is not what you want to do.

Bob :feels like eating something made out of flour:


References: 
 >Re: Initializing an Array (From: jgo <email@hidden>)

  • Prev by Date: use of NSUnarchiver
  • Next by Date: Re: class design issue
  • Previous by thread: Re: Initializing an Array
  • Next by thread: RunModalForWindow
  • Index(es):
    • Date
    • Thread