polymorphism: overloading vs. overriding
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sun May 7 05:30:44 PDT 2006
Bruno Medeiros wrote:
>
> No, it's not unnatural. For a function to override another, the return
> type must be covariant, but the parameters must be contravariant.
> It's quite natural to be this way, in fact, it's the only correct way
> (other than invariant parameters).
Whoa, I forgot to mention: D doesn't support contravariant parameters,
only covariant return types (in other words, a covariant parameter will
create a new overload, and not an override). I don't know why I got the
idea that D supported that.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list