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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:31:54+00:00 2026-06-01T07:31:54+00:00

I am using Objective-C in my app and I have a question about multiple

  • 0

I am using Objective-C in my app and I have a question about multiple inheritance in @interface declarations.

Pretty much this is what my .h looks like now:

#import "cocos2d.h"

    @interface UIViewController (Save)

    - (void)saveImage:(UIImage*)image:(NSString*)imageName;
    - (void)removeImage:(NSString*)fileName;
    - (UIImage*)loadImage:(NSString*)imageName;

    @end

    @interface CCLayer (Save)
    - (UIImage*)loadImage:(NSString*)imageName;
    - (BOOL)checkExists:(NSString*)thePath;
    @end

So as you can see, I have declared the loadImage method twice. I do not want to do this. This also means I have to have the same code in my .m twice for that method.

Is there any way to mix the UIViewController and CCLayer into 1 @interface so that I do not have to declare it multiple times?

Thanks!

  • 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-01T07:31:56+00:00Added an answer on June 1, 2026 at 7:31 am
    1. ObjC has no multiple inheritance.
    2. you do not want multiple definitions of the same SEL in the same class.
    3. you could declare (and adopt) a protocol. then you would define the method (loadImage:) in the @interface which declared adoption. you can also declare it in a dummy category, then define loadImage: in another @implementation scope.
    4. an alternative to this is composition — basically, you would add a class or protocol instance variable to your class and let it perform the work. if this is pubic interface, then you could also provide an accessor to it, or you could wrap it as needed. this is worth consideration if your 50 methods per @interface may be logically subdivided.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I have read about that I can write Objective-C app on Linux (using
Im working on an ios app using objective c and i have an issue
Hey guys. I have an app in Objective C (using xcode) that I would
I'm assuming this warning is crashing my app. I'm using objective-c for an iOS
I have a question about the objective C. I am writing the iPhone application
This question might seem vague, sorry. Does anybody have experience writing RegEx with Objective-C
I have an Objective-C app build on Linux with GCC 4.3 using no specific
I have been using objective-C to develop in iOS. Now we want to develop
I've been trying to implement a simple component-based game object architecture using Objective-C, much
Before I start: I'm programming for Iphone, using objective C. I have already implemented

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.