Let's take a look at the following code:
package A;
public interface MySuperInterface{
enum MyENUM { ...}
}
public class MyImplementingClass implements MySuperInterface{
public void someFunction(MyENUM e);
}
package B;
import A.MyImplementingClass;
public class MyClientClass{
MyImplementingClass mic = new MyImplementingClass();
mic.someFunction( /* here's my question. I need MyClientClass to know only about MyImplementingClass and nothing about MySuperInterface */);
}
As you can see above, in order to use someFunction()
, MyClientClass
needs to know about a (ENUM) type called MyENUM
which is defined inside MySuperInterface
. My question is, is it possible to design MyClientClass
to know only about MyImplementingClass
and nothing about MySuperInterface
?
In other words, MyClientClass
doesn't need to import MySuperInterface
.
Aucun commentaire:
Enregistrer un commentaire