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

Re: Objective-C Question


  • Subject: Re: Objective-C Question
  • From: Dave <email@hidden>
  • Date: Tue, 12 Mar 2013 07:59:54 +0000


On 11 Mar 2013, at 21:14, Mike Abdullah wrote:

if from an instance  + Method I do:

[super someMethod], then surely it's an error because this isn't an instance?

It *is* an instance. An instance of the *metaclass*. This is where you're deep into the guts of Objective-C :)

Hmmmm, I think I kind of knew this already but the details were fuzzy. Ok, i understand what you mean, so is the following correct:

1. In a Instance - method, if you do [self someMethod] it will call - someMethod in the current class if it is defined there, or it will call -someMethod, in one of the parents of the current instance or error if -someMethod is not defined. If -someMethod is defined, and it calls [self -someMethod] then it will call as high up the chain as possible, e.g. will find -someMethod in one of the subclasses if it is defined or it will call it's own version?

e.g.

BaseClass           <--- 	Subclass1	<---	 Subclass2	<--- Subclass3
-someMethhod	<---------------------------	 Subclass2	<--- Subclass3

_______________________________________________

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

References: 
 >Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Mike Abdullah <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Jens Alfke <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: Objective-C Question
  • Next by Date: Re: Issue with makeKeyAndOrderFront
  • Previous by thread: Re: Objective-C Question
  • Next by thread: Re: Objective-C Question
  • Index(es):
    • Date
    • Thread