• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling original method implementation from category
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling original method implementation from category


  • Subject: Re: Calling original method implementation from category
  • From: Stephane Sudre <email@hidden>
  • Date: Mon, 25 Apr 2005 13:09:58 +0200


On 25 avr. 05, at 11:54, Georg Tuparev wrote:


On Apr 25, 2005, at 11:28 AM, Yann Bizeul wrote: [...]

It is described in countless books, articles, online docs, and postings. But someone have to read them :-)

Do you have any reference available explaining that you can override a method with a category?


The documents I have read always use the terms: add a method, extend a class, etc.

And for the record, here is what an override attempt gives:

#import <Foundation/Foundation.h>

@interface NSString (test)

- (unsigned int)length;

- (unsigned int)length2;

@end

@implementation NSString (test)

- (unsigned int)length
{
	return 1;
}

- (unsigned int)length2
{
	return 1;
}

@end

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	NSString * testString=@"sgjfhjsgfhjsdgfhj";


	NSLog(@"Length of %@ is: %u",testString,[testString length]);

    // insert code here...
    NSLog(@"Length2: %u",[testString length2]);
    [pool release];
    return 0;
}


Result:

Length of sgjfhjsgfhjsdgfhj is: 17
Length2: 1

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Calling original method implementation from category
      • From: j o a r <email@hidden>
    • Re: Calling original method implementation from category
      • From: Johnny Deadman <email@hidden>
    • Re: Calling original method implementation from category
      • From: j o a r <email@hidden>
References: 
 >Calling original method implementation from category (From: Georg Tuparev <email@hidden>)
 >Re: Calling original method implementation from category (From: Yann Bizeul <email@hidden>)
 >Re: Calling original method implementation from category (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Re: Beveled outline around a view(BevelBox): How to?
  • Next by Date: Re: Calling original method implementation from category
  • Previous by thread: Re: Calling original method implementation from category
  • Next by thread: Re: Calling original method implementation from category
  • Index(es):
    • Date
    • Thread