Let's say I have theses classes A (Client), B, C.
Class B needs to create an instance of Class C, then do some operations on that instance.
However, Class A needs to do some cleanup on that instance after Class B has run, but it is unable to do the creation of Class C for B as B as certain configuration options it needs to pass to C during creation.
What is the best cleanest pattern for doing this?
I was thinking of having A create a Factory which B then calls make
with its extra arguments. However, that would still not grant access to the instance of C to A (It is not viable just to return C).
Aucun commentaire:
Enregistrer un commentaire