I am unable to understand contravariance wrt functiontype 1. The definition of function type1 is as below :
Function1(-T,+T)
The definition clearly says the input type parameter is contravariance. So a superclass type of a type should be allowed as parameter. But why is this giving compiler error.
I have defined below classes
class Animal
class Mammal extends Animal
class Cow extends Mammal
I have defined method as below
def move(m:Mammal) = Unit c
When I am invoking move like in below it gives no error
move (new Cow)
but this gives error
move(new Animal)
Why is that I am not able invoke move() with Animal as param even though Function1 is contravariant[-T] .
I am new to Scala, so please help me out in this