* Tony Johansson:
Can somebody explain what does argument contravariance mean.
I know what covariance mean because this is involved in some way when we
have argument contravariance .
Use some easy code exampe to describe this.
That last sounds like HOMEWORK -- however...
Co-variant means that an argument type is more specialized in a more
specialized (a derived) class, that's what "co" -- with -- stands for.
I mention that, which you claim to know, because contra-variant is just the
opposite, and that shouldn't be too hard to guess... Or Google.
Co-variant is compatible with the Liskov Substitution Principle (LSP) for an
out-argument, and contra-variant is compatible with LSP for an in-argument.
C++ does not support designation of argument data flow direction except for
function return values, so C++ does not support co/contra-variant arguments
except for function return values, which are allowed to be [insert the right
term here, Tony, is it in or out?]. C# lets you specify that an argument is
an out-argument, but currently does not support [the right term] for arguments
designated as out. Ada allows you to designate arguments as in or out, but I
don't know what Ada supports regarding co- and contra-variance.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?