Re: shouldn't polymorphism work here?
Re: shouldn't polymorphism work here?
- Subject: Re: shouldn't polymorphism work here?
- From: Ondra Cada <email@hidden>
- Date: Mon, 28 Mar 2005 12:55:51 +0200
Oh, sorry, I forgot:
On 28.3.2005, at 8:05, Conrad Carlen wrote:
Is there anything I can do make it more clear to the compiler and to
avoid this warning?
Sure: cast middleValue to a concrete class, like
if ([(NSString*)middleVal compare:item]<0) { // can be actually
anything, cast just gets rid of warning caused by wrong declarations
Note this does not change *anything* for the runtime. It just makes the
compiler think middleVal is always an NSString, so that it won't
complain; runtime the polymorphism *does* take care properly whatever
class middleVal actually belongs to.
This techique is completely safe far as the messages differ this way
only (should they have arguments -- or return values -- of non-object
data, like structs, floats or so, it would be a problem).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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