抽象工厂

4.Abstract Factory(抽象工厂)
作用:创建某一种类的对象
JDK中体现:
(1)java.sql包
(2)UIManager(swing外观)
类图:

 

package ttyouni.factory;
//抽象工厂
public interface AbstractFactory {
    public Button newButton();
    public Text newText();
}

interface Button
{
    
}

class WindowsButton implements Button
{
    
}
class UnixButton implements Button
{
    
}
interface Text
{
    
}
class WindowsText implements Text
{
    
}
class UnixText implements Text
{
    
}
View Code

 

posted @ 2017-07-25 22:50  连先森  阅读(83)  评论(0编辑  收藏  举报