I have a class that implements multiple methods, and I want to write methods to expect them .I don’t know how to do it, or it’s even possible.
For example:
public void yellAtPet( extends Pet implements YellableAt> arg) {
arg.yellAt("Don't go there!");
arg.pet("Good Boy");
}
publicvoid yellAtPet(T arg) {
arg.yellAt("Don't go there!");
arg.pet("Good Boy");
}
I don’t know why I can’t find this answer online.
I have a class that implements multiple methods, I want to write methods to expect them. I don’t know how to do it, or maybe even possible.
For example:
public void yellAtPet( extends Pet implements YellableAt> arg) {
arg.yellAt("Don't go there!");
arg.pet("Good Boy");
}
This should work as a generic method without making the entire class generic:
publicvoid yellAtPet(T arg) {
arg.yellAt("Don't go there!");
arg.pet("Good Boy");}