Lets say I've got two classes Person and Child. Child inherits from Person. I have also 2 other classes Class1 and Class2.
Class1 has constructor with only one parameter - its a java.util.List of Person. Class2 has List of Child. I want to pass these childs to Class1 constructor. But I can't do it - Eclipse says that
The constructor Class1(List<Child>) is undefined.
I thought it would be possible because Child inherits from Person. What is the problem?
SSCCE (not compilable) may looks like this:
Somewhere in Class2
List<Child> childs = new ArrayList<Child>();
new Class1(childs);
Class1 constructor
public Class1(List<Person> persons)
{
//do nothing();
}