mercredi 27 mars 2019

Adapter Design Pattern: Expose private adaptee instance of the Adapter class Except for the Client code?

Is there any way I could have private adaptee instance inside the Adapter class exposed when I need it except for the client code?

To elaborate, there are certain cases where I would want to expose the adaptee instance from the Adaptor for the public, but I do Not want to do it with the client code. Therefore would it be appropriate to write a method within the Adapter class like this one:

public Adaptee ExposeAdaptee(){
    return _adapteeInstance;
}

enter image description here

Aucun commentaire:

Enregistrer un commentaire