Why oc

zhaozj2021-02-12  160

Public class a {b comp; public a (b comp) {this.comp = comp;} public string helloworld () {return "hello" comp.world ();}}

Without any excess code, a only the function of B, so in addition to a to B's interface reference, there is no other. In this way, whether the way to obtain this component is through POJO, JINI or the web services, the component itself does not need to change.

Secondly, if Factory Method can provide global unique object acquisition points, each object plant can only target a class system (hierarchy), the factory will be flooding for many large applications in the component system. . The IOC container can provide a true unique object acquisition point, but the cost of loss type is also paid.

转载请注明原文地址:https://www.9cbs.com/read-6374.html

New Post(0)