oop - Java Inheritance: Superclass being "overriden" by Subclass function with different signature -
i quite rusty on java , i'm having hard time following: public abstract class animal implements comparable<animal> { //enum stored elsewhere animaltype type = null; private specificcompare(animal a){ return 0; } @override public int compareto(animal a){ int comp = type.compareto(a.type); if (comp > 0) { return 1; } else if (comp < 0) { return -1; } else { return specificcompare(a); } } } public class mammal extends animal { private mammalstuff; public mammal(){ ... } public specificcompare(mammal m){ //do specific comparison } } so, understand why mammal's specificcompare isn't being called (incorrect type) i'm trying figure out clean way make work. want able extend animal , have correctly call specific comparison when needed. in addition actual answer, if has suggested documentation me read on ha...