• 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: Trying to understand -- please help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to understand -- please help...


  • Subject: Re: Trying to understand -- please help...
  • From: "Vijay Malhan" <email@hidden>
  • Date: Thu, 22 May 2008 00:44:20 +0530

Thanks for the pointers to the documentation. This is sample snippet from
the documentation.

@implementation MyClass

+ (void)initialize

{

    if ( self == [MyClass class] ) {

        /* put initialization code here */

    }

}


If I'm not wrong "self" equivalent of "this" which points to an instance
var. And it is initialized in - init (instance)method. And if it fails to
initialize, it's nil. So does "self" even exist when + initialize is called.
Cuz as per documentation it is the first method called for a Class, before
+alloc and -init methods are called.

Or the comparison condition in above example is not valid.
Thanks in advance.






On Thu, May 22, 2008 at 12:30 AM, Shawn Erickson <email@hidden> wrote:

> On Wed, May 21, 2008 at 11:47 AM, Vijay Malhan <email@hidden>
> wrote:
>
> >        What exactly do you mean by initializing the *class*? what exactly
> is
> > initialized with +initialize() method?
> >        When exactly this method gets called?
>
> Look for the subsection titles "Initializing a Class Object" on the
> following page...
>
> <
> http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_4.html#//apple_ref/doc/uid/TP30001163-CH11-TPXREF115
> >
>
> Also...
>
> <
> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/clm/NSObject/initialize
> >
>
> -Shawn
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trying to understand -- please help...
      • From: Jens Alfke <email@hidden>
    • Re: Trying to understand -- please help...
      • From: "Sherm Pendley" <email@hidden>
    • Re: Trying to understand -- please help...
      • From: Andy Lee <email@hidden>
    • Re: Trying to understand -- please help...
      • From: "Shawn Erickson" <email@hidden>
References: 
 >Trying to understand -- please help... (From: Peter Hudson <email@hidden>)
 >Re: Trying to understand -- please help... (From: "I. Savant" <email@hidden>)
 >Re: Trying to understand -- please help... (From: "I. Savant" <email@hidden>)
 >Re: Trying to understand -- please help... (From: Vijay Malhan <email@hidden>)
 >Re: Trying to understand -- please help... (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: Re: Trying to understand -- please help...
  • Next by Date: Re: Cocoa et al as HCI usability problem
  • Previous by thread: Re: Trying to understand -- please help...
  • Next by thread: Re: Trying to understand -- please help...
  • Index(es):
    • Date
    • Thread