Re: [MyClass class] returning superclass's class
Re: [MyClass class] returning superclass's class
- Subject: Re: [MyClass class] returning superclass's class
- From: Alexander Spohr <email@hidden>
- Date: Thu, 20 Nov 2008 12:46:33 +0100
Ken,
Your Mails title says „[MyClass class] returning superclass's class“
which is not true and Andy just proved that.
You are talking to a class-cluster. The whitespaceCharacterSet call is
answered by NSCharacterSet, not by your subclass. And NSCharacterSet
will return a subclass that NSCharacterSet thinks will fit your
requirements best.
Please read about class-clusters as Jean-Daniel already pointed out.
atze
Am 20.11.2008 um 11:37 schrieb Ken Tozier:
@interface KOptionString : NSCharacterSet
{
}
@end
KOptionString *whiteTest = [KOptionString whitespaceCharacterSet],
*hexTest = [KOptionString characterSetWithCharactersInString:
@"0123456789abcdefABCDEFxX"];
NSLog(@"whiteTest %@", [whiteTest class]);
NSLog(@"hexTest %@", [hexTest class]);
whiteTest result -> NSBuiltinCharacterSet
hexTest result -> NSCFCharacterSet
On Nov 19, 2008, at 8:48 AM, Andy Lee wrote:
Works for me:
@interface MyClass : NSCharacterSet
@end
@implementation MyClass
@end
...
NSLog(@"[MyClass class] returns [%@]", [MyClass class]);
2008-11-19 08:44:27.891 Scratch2[24671:10b] [MyClass class] returns
[MyClass]
Can you post some code?
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden