第二银行

yp.wang

导航

1.接口与工厂 Interface and Factory of Design Pattern

Posted on 2010-12-23 21:25  第二银行  阅读(153)  评论(0)    收藏  举报
代码
interface Service{
void method1();
void method2();
}

interface ServiceFactory{
public Service getService();
}

class Factories{
public static void ServiceConsumer(ServiceFactory fact){
Service s
= fact.getFactory();
s.method1();
s.method2();
}
}