• 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: Kyle Sluder <email@hidden>
  • Date: Mon, 11 Mar 2013 14:18:34 -0700

On Mon, Mar 11, 2013, at 01:55 PM, Dave wrote:
> Not sure I understand:
>
> if from an Instance - Method, I do:
>
> [super someMehod];
>
> It calls -someMehod in the superclass.
>
> if from an instance  + Method I do:
>
> [super someMethod], then surely it's an error because this isn't an
> instance?

No, it's not an error. Classes are instances of their metaclass; a
class's superclass is an instance of the superclass's metaclass.

Greg Parker explains:
http://www.sealiesoftware.com/blog/archive/2009/04/14/objc_explain_Classes_and_metaclasses.html

>
> So from a + method, what do:
>
> [super someMethod]; and

Invokes the superclass's (or an ancestor's) implementation of
+someMethod.

> [[self superclass] someMethod];

Sends +someMethod to the superclass, which will invoke the superclass's
implementation or the implementation of an ancestor.

--Kyle Sluder
_______________________________________________

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>)

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