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

  • Home
  • SEARCH
  • 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 8940123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:57:59+00:00 2026-06-15T10:57:59+00:00

I just started learning this, so sorry if this has some obvious solution I

  • 0

I just started learning this, so sorry if this has some obvious solution I still can’t grasp.

I have these two classes:

@implementation Person
-(void)saySomething:(NSString*) something {
    NSLog(@"%@",something);
}
-(void)yellSomething:(NSString*) something {
    [self saySomething:[something uppercaseString]];
}
@end

and

@implementation ShoutingPerson : Person

-(void)saySomething:(NSString*)something {
    [super yellSomething:something];
}

@end

This is causing a circular reference call because saySomething is always being called on the descendant class.

How can I make yellSomething invoke the saySomething method on Person class instead of the descendant class ?

  • 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-15T10:58:01+00:00Added an answer on June 15, 2026 at 10:58 am

    As Jonathan says, you really should avoid this if at all possible. It’s just a bad design to need this functionality. If your base class is intended to be subclassed, its documentation should spell out which methods must be overridden and which others may be overridden. Anything else should not be overridden, to avoid problems like this.

    That said, if you are in a very unusual situation where it is necessary (perhaps you’re stuck working with 3rd party code that you cannot refactor), it is possible. But it’s not pretty. You need to call objc_msgSendSuper or objc_msgSendSuper_stret manually, after constructing an instance of struct objc_super pointing to self and YourBaseClass.

    Note that if you’re coming from C++ the default behaviour there is the same – if you call SomeFunction() from your base class and it’s a virtual method, the subclass’s override will be executed. You would have to prefix your call to spell out the class explicitly, e.g. MyBaseClass::SomeFunction(). There’s no direct equivalent for that in Objective-C – I’d say because it’s just such a bad idea generally.

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

Sidebar

Related Questions

I have two users Jason and postgres . Since I just started learning this,
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I have just started learning XNA. This is my first program that I am
I have just started learning PHP, and here's my first doubt... Both of these
I have just started learning Qt and compiled and executed this spinet #include <qapplication.h>
I just started learning C++ couple of weeks ago. So now I have this
I just started learning some ruby, and I want to do something like this:
I have just started learning wordpress plugin development and got this error when I
I'm just started learning scheme and can't quite understand why this function does not
I just started learning objective c. I have this little problems and questions, hope

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.