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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:25:11+00:00 2026-06-18T19:25:11+00:00

is it possible to override a method as a category method ? @implementation CCSprite

  • 0

is it possible to override a method as a category method ?

@implementation CCSprite (Utilities)

-(void)draw //its already a member of CCSprite but I wantto override it. but within a category
{
   [super draw];
   [self doSomethingExtra];
}
@end

purpose: preventing to copy-paste same codeblock for each drived CCMySprite class.thinking Just import and use.

  • 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-18T19:25:13+00:00Added an answer on June 18, 2026 at 7:25 pm

    No, this isn’t suggested by Apple, it’s undefined behavior if you do that. One of the two methods will be used in this case, and you can’t know which one.

    Avoid Category Method Name Clashes

    Because the methods declared in a category are added to an existing class, you need to be very careful about method names.

    If the name of a method declared in a category is the same as a method in the original class, or a method in another category on the same class (or even a superclass), the behavior is undefined as to which method implementation is used at runtime. This is less likely to be an issue if you’re using categories with your own classes, but can cause problems when using categories to add methods to standard Cocoa or Cocoa Touch classes.

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

Sidebar

Related Questions

Is it possible to override the paint method, or draw onto a JFrame with
Is it possible to override the GetHashCode method for a string, int, int32 etc..
It is possible in plain Java to override a method of a class programmatically
I want to override the Tostring() method for changing some characters. Is it possible?
Is it possible to override the to_sentence method just for one model in my
Is it possible to override a private method by using Reflection in .NET 3.5?
Possible Duplicate: Is there any way in C# to override a class method with
In C# it is not possible to override a static method. Nevertheless I have
Is there any possible way to override the sync method for PUT response and
Is it at all possible to override a private method of a super class

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.