Originally posted by Andry Dub:
Hi, ranchers! Please explain me why first code compiles fine, but second generates compile time error? What is the main idea on this?
In the first code, you have a collection of instances that are base classes of Object (which can only be Object) and an Object instance. There is a type that matches the method that you defined (Object).
In the second code, you have a collection of instances that are sub classes of Object (which can be anything) and an Object instance. There isn't a type that matches the method that you defined.
The most interessant is that if you pass only one argument, the code compiles...
It would be more interesting... if you show us this code that compiles.
Henry