I have situation where I have to restrict the access to a class. to further elaborate, I have two classes, say A
and B
that depend on class C
, but A
doesn't need to use the complete interface of C
, the same goes to B
. What I did was, make C
implement two different interfaces, one interface A
can access, the other for B
to refer to. What I am doing here, is it correct? or should I just document this? or else is there a better approach?
To give more context, I am trying to implement an system which allows an interface for plug-ins. And I don't want someone accessing parts of a class I don't want them to.
Aucun commentaire:
Enregistrer un commentaire