标签:out tst rod print 静态 main ace factor code
interface clothFactory{ void productCloth(); } class NikeClothFactory implements clothFactory{ @Override public void productCloth() { System.out.println("Nike生产了衣服"); } } class ProxyClothFactory implements clothFactory{ NikeClothFactory nc; public ProxyClothFactory (NikeClothFactory obj){ this.nc=obj; } @Override public void productCloth() { System.out.println("通过了静态代理"); nc.productCloth(); } } public class TestStaticProxy { public static void main(String[] args) { NikeClothFactory nf1 = new NikeClothFactory(); nf1.productCloth(); ProxyClothFactory nf2 = new ProxyClothFactory(nf1); nf2.productCloth(); } }
标签:out tst rod print 静态 main ace factor code
原文地址:https://www.cnblogs.com/MagicAsa/p/11745844.html