Re: Question on Categories
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