By dontWatchMyProfile


2010-06-22 17:02:41 8 Comments

As far as I know, it's a pointer to the superclass. It's hard-wired with the superclass, and not dynamically figured out at runtime. Would like to know it more in detail...

Anyone?

4 comments

@Ben S 2010-06-22 17:05:48

super

Essentially, it allows you to use the implementations of the current class' superclass.

For the gritty details of the Objective-C runtime:

[super message] has the following meaning:

When it encounters a method call, the compiler generates a call to one of the functions objc_msgSend, objc_msgSend_stret, objc_msgSendSuper, or objc_msgSendSuper_stret. Messages sent to an object’s superclass (using the super keyword) are sent using objc_msgSendSuper; other messages are sent using objc_msgSend. Methods that have data structures as return values are sent using objc_msgSendSuper_stret and objc_msgSend_stret.

So yes, it is static, and not determined at runtime.

@Olie 2014-07-31 01:13:33

Possibly cause for a new question, but super behaves oddly (or "normally", if you think that way) in categories. That is, it treats the category as a subclass (not an override), so super is then the original, unmodified class. Sort of. Sometimes. "It's complicated."

@David Gelhar 2010-06-22 17:13:07

These blog postings on what is a meta class?, getting subclasses and classes and metaclasses may give you some insight on the internals of this.

@NSResponder 2010-06-22 17:11:12

super is not a pointer to a class. Super is self, but when used in a message expression, it means "look for an implementation starting with the superclass's method table."

@user529758 2012-11-24 07:51:00

This is not true for class methods.

@Chuck 2010-06-22 17:09:05

It's a keyword that's equivalent to self, but starts its message dispatch searching with the superclass's method table.

Related Questions

Sponsored Content

92 Answered Questions

22 Answered Questions

[SOLVED] How do I check if a string contains another string in Objective-C?

16 Answered Questions

[SOLVED] How do I call Objective-C code from Swift?

  • 2014-06-02 20:05:42
  • David Mulder
  • 273802 View
  • 934 Score
  • 16 Answer
  • Tags:   objective-c swift

11 Answered Questions

[SOLVED] What is PECS (Producer Extends Consumer Super)?

25 Answered Questions

[SOLVED] How do I sort an NSMutableArray with custom objects in it?

7 Answered Questions

[SOLVED] Understanding Python super() with __init__() methods

13 Answered Questions

[SOLVED] What is a typedef enum in Objective-C?

8 Answered Questions

[SOLVED] What does 'super' do in Python?

14 Answered Questions

[SOLVED] Constants in Objective-C

30 Answered Questions

[SOLVED] Shortcuts in Objective-C to concatenate NSStrings

Sponsored Content