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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:21:23+00:00 2026-05-25T21:21:23+00:00

I have two classes, named Parent and Child , as below. Parent is the

  • 0

I have two classes, named Parent and Child, as below. Parent is the superclass of Child I can call a method of the superclass from its subclass by using the keyword super. Is it possible to call a method of subclass from its superclass?

Child.h

#import <Foundation/Foundation.h>
#import "Parent.h"

@interface Child : Parent {

}

- (void) methodOfChild;

@end

Child.m

#import "Child.h"

@implementation Child

- (void) methodOfChild {

    NSLog(@"I'm child");

}

@end

Parent.h:

#import <Foundation/Foundation.h>

@interface Parent : NSObject {

}

- (void) methodOfParent;

@end

Parent.m:

#import "Parent.h"

@implementation Parent

- (void) methodOfParent {

    //How to call Child's methodOfChild here?

}

@end

Import “Parent.h” in app delegate’s .m file header.

App delegate’s application:didFinishLaunchingWithOptions: method..

Parent *parent = [ [Parent alloc] init];

[parent methodOfParent];

[parent release];
  • 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-25T21:21:24+00:00Added an answer on May 25, 2026 at 9:21 pm

    You can, as Objective C method dispatch is all dynamic. Just call it with [self methodOfChild], which will probably generate a compiler warning (which you can silence by casting self to id).

    But, for the love of goodness, don’t do it. Parents are supposed to provide for their children, not the children for their parents. A parent knowing about a sub-classes new methods is a huge design issue, creating a strong coupling the wrong way up the inheritance chain. If the parent needs it, why isn’t it a method on the parent?

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

Sidebar

Related Questions

I have two classes named BaseCatalog and City. BaseCatalog is the parent class of
Let's say I have two classes, Parent and Child. These two are related via
Say I have two classes: Parent and Child . A Parent has a property
I have two classes with a parent-child relationship (the Parent class has-a Child class),
I have two classes, Parent and Child. The code for the classes are like
I have the following two classes: Claim (parent) and ClaimInsurance (child). They are as
I have two classes (MVC view model) which inherits from one abstract base class.
I have two classes A and B generated by cxf-codegen-plugin from my WSDL. A
I have two classes Foo and Bar that Bar extends Foo as below: class
I have two classes, Item and SoldItem . SoldItem inherits from Item adding some

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.