I have an abstract class A
public astract class A{
public abstract A f(A a) throws IllegalArgumentException;
};
but I want object a passed to f to have the same type of the object itself and return an object of same type, otherwise throw an IllegalArgumentException. How can I implement that one time for all subclasses? There is a way to do that at the class A level?
Aucun commentaire:
Enregistrer un commentaire