Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8021429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:58:44+00:00 2026-06-04T21:58:44+00:00

just had a noob question. I’m trying to understand the difference between calling self

  • 0

just had a noob question. I’m trying to understand the difference between calling self and super. Now I understand inheritance and other fundamental OOP concepts, but the idea of self and super is still not clear to me. I’ll illustrate my question with an example.

So the the below code performs a segue when the phone is tilted upside-down. I understand that “Scene2ViewController” is a subclass of “UIViewController” and so “Scene2ViewController” inherits all of UIViewController’s methods. And so below I’m calling the method performSegueWithIdentifier with the receiver of the message being self. Now when I change “self” to “super” the code still executes the same way. Isn’t calling super the same as calling self? If someone could explain this to me it would be appreciated, thanks.

//Scene2ViewController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:  (UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
    [self performSegueWithIdentifier:@"SegueToScene1" sender:self];
}

return (interfaceOrientation == 
        UIInterfaceOrientationPortrait);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:58:46+00:00Added an answer on June 4, 2026 at 9:58 pm

    self and super actually both point to the same object. super is a keyword that tells the compiler to generate instructions that start the search for a method definition in the super class rather than in the current class.

    @interface A : NSObject {}
    - (void)foo;
    @end
    
    @implementation A
    - (void)foo {
        NSLog(@"A's foo!");
    }
    @end
    
    @interface B : A
    @end
    
    @implementation B
    - (void)foo {
        NSLog(@"B's foo!");
    }
    @end
    
    //...somewhere in a method of class B...
    [self foo];    // prints "B's foo" in the console
    [super foo];    // prints "A's foo" in the console
    

    If we assume, per the comment, that the last lines are somewhere in a method of B, then self points to some instance of B. super also points to that same instance of B. But when you use self to call foo, the search for an implementation of foo starts with class B. When you use super, the search for a foo starts with B’s superclass, A.

    super is especially handy when you want to preserve the inherited behavior, but add something on. So, we could have B’s implementation of foo call A’s version using [super foo]. Without super there’d be no way to call the inherited method, and calling foo from the overridden method would result in infinite recursion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still learning C# and just had a basic question about inheritance. Lets say
just had a general question about how to approach a certain problem I'm facing.
I just had the jQuery epiphany the other day and still feel like there
I just had a quick question about git - how backwards compatible are git
I just had a ridonkulous typo in my iPhone app, answered here . Now
I just had a question about aligning two expand-collapse boxes and got an answer
I just had my app crash and now after alot of work its back
Just had a question regarding the UILabel class. I know that the UITextField control
I just had this html email figured out and now i need to style
Just had a quick question to throw out and see if there was a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.