• 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
Another Gnarly Objective-C Question!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another Gnarly Objective-C Question!


  • Subject: Another Gnarly Objective-C Question!
  • From: Dave <email@hidden>
  • Date: Tue, 12 Mar 2013 08:39:54 +0000

Hi All,

Thanks for all help on the last question, here is one on a similar vein:

This is all Class methods, no instances are allocated or intended to be allocated at this stage.

in + Method in a subclass:

[[self class] someMethod];

This calls +someMethod in the current class, if it exists, if not, it calls in one of the super-classes if it exists. Is this correct?

If one of the super classes calls [[self class] someMethod]; It will call as high up the chain as possible, resulting in an infinite loop in this case?

Is there a diagram somewhere showing how this works for the 4 cases of:

1.  [[self class] +someMethod];
2.  [[super class] +someMethod];
3.  [super +someMethod];
4. [[self superclass] +someMethod];

It does seem logical to expect that if:

[[self class] someMethod]; calls +someMethod the [[super class] +someMethod] would call +someMethod in the Superclass or is it just me??? lol

Thanks a lot
Dave

_______________________________________________

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: Another Gnarly Objective-C Question!
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Issue with makeKeyAndOrderFront
  • Next by Date: Re: Objective-C Question
  • Previous by thread: Re: Fast user switching notifications
  • Next by thread: Re: Another Gnarly Objective-C Question!
  • Index(es):
    • Date
    • Thread