polymorphism: overloading vs. overriding

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Thu Jun 15 07:58:57 PDT 2006


Markus Kranz wrote:
> Uh, I didn't know the issue of "covariance versus contravariance" is a topic of
> continuing debate:
> 
> http://c2.com/cgi/wiki?ContraVsCoVariance
> 
> and especially
> 
> http://www.cs.trinity.edu/~mlewis/CSCI3294-F01/Papers/p431-castagna.pdf
> 
> where I found on page 10:
> 
> "At this point, we are able to make precise the roles played
> by covariance and contravariance in subtyping: contravariance 
> is the correct rule when you want to substitute a function 
> of a given type for another one of a different type; 
> covariance is the correct condition when you want to specialize 
> (in object-oriented jargon "override") a branch of an overloaded 
> function by one with a smaller input type."
> 
> Regards,
> Markus
> 
> 

I finally took the time to read it, it is indeed a good article.

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list