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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:12:53+00:00 2026-06-04T06:12:53+00:00

After some research, I can’t find anything on super classes, so I decided to

  • 0

After some research, I can’t find anything on super classes, so I decided to ask here.

Example

@interface superClass : CCSprite
@end

@interface subClass : superClass
@end

How do the two above examples relate to each other? Also, I was shown that you could add a method the the superClass, and then use it in the subClass (how?)?

  • 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-04T06:12:54+00:00Added an answer on June 4, 2026 at 6:12 am

    CCSprite is the super class of superClass
    superClass is the super class of subClass

    there is two ways of using method in super class, for example

    @interface superClass : CCSprite
    - (void)doSomething;
    - (id)somethingElse;
    @end
    
    @implement superClass
    - (void)doSomething {
        NSLog( @"do something in super class" );
    }
    - (id)somethingElse {
        return @"something else in super class";
    }
    @end
    
    @interface subClass : superClass
    - (void)doSomethingTwice;
    @end
    @implement subClass
    - (void)doSomethingTwice {
        [self doSomething];
        [self doSomething];
    }
    - (id)somethingElse {
        id fromSuper = [super somethingElse];
        return @"something else in sub class";
    }
    @end
    

    subClass sub = [[subClass alloc] init];
    [sub doSomethingTwice];   // this will call `doSomething` implemented is superClass twice
    NSLog([sub somethingElse]); // this will call `somethingElse` in super class but return "something else in sub class" because it override it
    

    basically you can just call the method implemented in super class on instance of sub class

    and you can override the method in sub class to do something different and/or using [super methodName] to call the method implementation in super class

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

Sidebar

Related Questions

I think it is not complicated but after doing some research I can't find
After some research on the web without success, I come here to ask you
After some research, it is my understanding that this is not possible. I can
C++ question here. I've successfully (after some research :P) created a linked-list implementation for
I am currently writing a paper on the Android platform. After some research ,
After doing some research on the subject, I've been experimenting a lot with patterns
[Edited: After cross-testing on a fresh machine and some additional research, this appears to
after some processing my program shows a messagebox saying you can read a log
after some research, we opted for working with Drupal on our next project and
After some research about algorithms I found two terms which confuses me. I've read

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.