I am trying to achieve the next:
Parent:
public class Animal {
private List<Animal> relatives;
public List<Animal> getRelatives() {
return relatives;
}
public void setRelatives(List<Animal> relatives) {
this.relatives = relatives;
}
}
Child:
public class Dog extends Animal {
private List<Dog> relatives;
public List<Dog> getRelatives() {
return relatives;
}
public void setRelatives(List<Dog> relatives) {
this.relatives = relatives;
}
}
But for some reason, I get errors that the methods are clashing. Is this even possible with inheritance, without using generic types?