What I mean is, in the code below:
class base {
}
class derived extends base {
}
class WTF {
public void func(List<base> list) {
}
public void tryit() {
func(new List<base>()); // ok
func(new List<derived>()); // not ok
}
}
But if the function simply took an object of base, it could take a derived object. Why is this?