« Return to Thread: parametric types and variance

Re: parametric types and variance

by Paul Phillips-3 :: Rate this Message:

Reply to Author | View in Thread

On Thu, Jul 09, 2009 at 04:23:40PM +0200, Christoph Drießen wrote:
> can anyone explain to me why the following code compiles? As I
> understand it, Aa acts as the lower bound in the implementation of
> classify in class AaClassifier and so I wonder why I'm able to pass in
> a String.

Because you're not passing a String, you're passing an AnyRef (which
happens to be a String.)

--
Paul Phillips      | One way is to make it so simple that there are
Moral Alien        | obviously no deficiencies. And the other way is to make
Empiricist         | it so complicated that there are no obvious deficiencies.
up hill, pi pals!  |     -- Hoare

 « Return to Thread: parametric types and variance