public interface DataAdapter {
int solve(int a, int b, int c)
}
Now i have multiple classes which implements this interface something like :
public class DataAdapterImplA implements DataAdapter {
int solve(int a, int b, int c) {
return ...
}
}
public class DataAdapterImplB implements DataAdapter {
int solve(int a, int b, int c) {
return ...
}
}
and similarly multiple others ...
Now i am adding one more implementing class but with one less parameter in the existing method signature ..something like below :
public class DataAdapterImplF implements DataAdapter {
int solve(int a, int b) {
return ...
}
}
So , question here is how to go about this :
-
Should i override the existing
solve(int, int, int)
method only & in my method body i can ignore this and won't use it at all ? -
should i create a
default
methodsolve(int, int)
in the interface & override that in my new implementation class ?
or any other better & clean solution ?
Aucun commentaire:
Enregistrer un commentaire