Re: confused about inheritance
Re: confused about inheritance
- Subject: Re: confused about inheritance
- From: Ivan Kourtev <email@hidden>
- Date: Wed, 29 Mar 2006 17:09:54 -0500
Thanks for the reply, I noticed the different return types too. I'll
file a bug.
--
ivan
On Mar 29, 2006, at 3:32 PM, Nick Zitzmann wrote:
On Mar 29, 2006, at 1:22 PM, Ivan Kourtev wrote:
NSMutableCharacterSet inherits from NSCharacterSet which has a +
characterSetWithCharactersInString method. Why then does the
statement
NSMutableCharacterSet *cs = [NSMutableCharacterSet
characterSetWithCharactersInString:@"#"];
produce an "initialization from distinct Objective-C type" warning?
I think you may have found a bug in Foundation. +[NSCharacterSet
characterSetWithCharactersInString:] returns an object of type
NSCharacterSet, whereas it really ought to return an object of type
id. Since what you're trying to do above may not actually return a
mutable character set (depending on how the method was implemented
internally), you might want to try this instead:
NSMutableCharacterSet *cs = [[[NSCharacterSet
characterSetWithCharactersInString:@"#"] mutableCopy] autorelease];
Please file a bug on this one...
By the same logic, I would expect
NSMutableString *s = [NSMutableString stringWithString:@"A"];
to generate a warning yet it does not.
What am I missing here?
+[NSMutableString stringWithString:@"A"] returns an object of type id.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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