• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: shouldn't polymorphism work here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shouldn't polymorphism work here?


  • Subject: Re: shouldn't polymorphism work here?
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 28 Mar 2005 12:49:09 +0200

Conrad,

On 28.3.2005, at 8:05, Conrad Carlen wrote:

When compiling this, I get the warnings:

/Users/<snip>/NSArray+Extensions.m:46: warning: multiple declarations for method `compare:'
/System/Library/Frameworks/Foundation.framework/Headers/NSValue.h:53: warning: using `-(NSComparisonResult)compare:(NSNumber *)otherNumber'
/System/Library/Frameworks/Foundation.framework/Headers/NSDate.h:29: warning: also found `-(NSComparisonResult)compare:(NSDate *)other'
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:74: warning: also found `-(NSComparisonResult)compare:(NSString *)string'


Now, as long as these objects implement compare:, shouldn't polymorphism take care of calling the right one?

It should and it actually does.

The only problem is compile-time, caused by wrong declarations -- instead of declared "compare:(NSNumber*)otherNumber" etc it should have been declared "compare:(id)otherObject" in all headers of all classes.

Runtime, it is completely all right.
---
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


References: 
 >shouldn't polymorphism work here? (From: Conrad Carlen <email@hidden>)

  • Prev by Date: Re: Possible to bind file contents to a view?
  • Next by Date: Re: shouldn't polymorphism work here?
  • Previous by thread: shouldn't polymorphism work here?
  • Next by thread: Re: shouldn't polymorphism work here?
  • Index(es):
    • Date
    • Thread