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 7635589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:27:55+00:00 2026-05-31T07:27:55+00:00

Please help me making this clear about instance methods in Objective C: Can send

  • 0

Please help me making this clear about instance methods in Objective C:

  • Can send messages to self and super inside
    • both dispatch the message to the calling object, but use different implementations
    • if a superclass of yours calls a method on self, it will [execute] your implementation (if one exists)

Lecture 3, Stanford University, Objectve-C course

  • 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-05-31T07:27:56+00:00Added an answer on May 31, 2026 at 7:27 am

    Okay, now that it’s actually possible to understand the question:

    Let’s say you have a class Foo with methods doSomething and doSomethingElse, and you make a subclass of Foo called Bar.

    In your implementation of Bar, if you wanted to call doSomething you could either do [self doSomething] or [super doSomething].

    • [super doSomething] would use the superclass’s implementation of doSomething—specifically, Foo‘s implementation.
    • [self doSomething] would use the class itself’s implementation of doSomething—that is, Bar‘s implementation. Note that if Bar didn’t actually override doSomething, then [self doSomething] would end up calling the superclass’s implementation.

    As for what happens if a superclass calls a method on self, let’s say Bar overrides doSomething, but doesn’t override doSomethingElse, and let’s say doSomethingElse looks like this:

    - (void)doSomethingElse
    {
        [self doSomething];
    }
    

    What happens if you call doSomethingElse on Foo *aFoo and Bar *aBar? The result of [aFoo doSomethingElse] is clear: it does [self doSomething] where self is a Foo, so Foo‘s implementation of doSomething will be executed.

    But when you do [aBar doSomethingElse] is where things get interesting, and is what Paul was getting at. since Bar doesn’t override doSomethingElse, Foo‘s implementation will be called, which in turn does [self doSomething]. But this time, self is an instance of Bar, and so Bar‘s implementation of doSomething will be called.

    Why would [self doSomething] in the implementation of Foo end up executing code from the subclass Bar? This is because of how messages are dispatched in Objective-C. [self doSomething] sends the message doSomething to the object self, and it is up to whatever object self is to decide what code gets executed. Since self, in this situation, would be a Bar, Bar‘s implementation of doSomething is executed.

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

Sidebar

Related Questions

This is making me lose my mind, so please help: $param[] = ($k ==
Please help me with this code, it is making me crazy. This is a
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
I need help making this loop to move a label move smoothly across the
I am new to this website and new to Jquery. So seniors please help
I have been stuck on this all weekend and failed miserably! Please help me
Someone please help me understand why this binding does not work... I have a
I have been reading stackOverflow answers for this question for hours. Please help me.
Please help! I'm really at my wits' end. My program is a little personal
Please help! Background info I have a WPF application which accesses a SQL Server

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.