• 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: Question on Categories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on Categories


  • Subject: Re: Question on Categories
  • From: Nat Lanza <email@hidden>
  • Date: Thu, 30 Mar 2006 13:55:22 -0500

Mike Abdullah wrote:
Basically, will subclasses inherit a category?

Yes. Here's a little snippet of test code that shows this:

nlanza@liebot:~> cat test.m
#import <Foundation/Foundation.h>
@interface TestString : NSString
@end
@implementation TestString
@end
@interface NSString (CategoryTest)
- (void) test;
@end
@implementation NSString (CategoryTest)
- (void) test {
NSLog(@"category method called on %@ object", [self class]);
}
@end
int main (int argc, char **argv) {
TestString *bar = [[TestString alloc] init];
[bar test];
exit(0);
}
nlanza@liebot:~> gcc -Wall -o test test.m -framework Foundation
nlanza@liebot:~> ./test
2006-03-30 13:53:21.102 test[26362] category method called on TestString object



--nat _______________________________________________ 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: Question on Categories
      • From: Mike Abdullah <email@hidden>
References: 
 >Question on Categories (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: NSWorkspace launchedApplications
  • Next by Date: Cocoa Software Dev. Position Open - San Diego
  • Previous by thread: Re: Question on Categories
  • Next by thread: Re: Question on Categories
  • Index(es):
    • Date
    • Thread