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