There is a fixed interface with some special logic, and this interface does not satisfy these special logic, the use of proxy mode to integrate special logic into the special class
Abstract role: A business method that declares the real role implementation through an interface or abstract class. Agent role: the implementation of abstract role, is the real role of the agent, through the real role of the business logic method to implement the abstract method, and can attach their own operations. Real role: Implement abstract roles, define the business logic to be implemented by the real role, for proxy role invocation. //abstract roles public interface italk{ publicly void talk ( String language); } //Real role public class people implements italk{ public void Talk (String language) { &NBSP ; //xxxxx } } //agent role Publi C class peopleproxyforsing implements italk{ italk _talk ; public peopleproxyforsing (Italk talk) { & nbsp _talk=talk; } &nbSp public void Talk (String language) { &NBS P //todo attach own special implementation _talk.talk (language);//Invoke Real role implementation//todo attach own special implementation &NBSP ; } }
Design mode-proxy mode