• 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: Mike Abdullah <email@hidden>
  • Date: Thu, 30 Mar 2006 21:58:17 +0100

Thanks guys - the wonders of Objective C!

Mike.

On 30 Mar 2006, at 19:55PM, Nat Lanza wrote:

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:
40gmail.com


This email sent to email@hidden

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

  • Prev by Date: Re: moving views
  • Next by Date: Re: Cocoa Endians for Mac-Intel
  • Previous by thread: Re: Question on Categories
  • Next by thread: Re: Cocoa-dev Digest, Vol 3, Issue 406
  • Index(es):
    • Date
    • Thread