I want to achieve something like this:
define an abstract method
public abstract void registerError(*any subclass of an ErrorVO or ErrorVO e);
and in subclass of actual implementation method:
public void registerError(ASubclassOfErrorVO e);
Thanks a lot for your help!
You can use generics in the declaration of the classes like this:
the
<T extends errorVO>in a definesTas an class extendingerrorVO. The reason this won’t work just with method declarations is that you could have many methods in the subclass that could potentially override the parent’s method, only by declaring the typeTat the class level does the compiler know which method is being overridden.