Abstract Factory
英文简单描述
Intent
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
How to
AbstractFactory
declares an interface for operations that create abstract product objects.
ConcreteFactory
implements the operations to create concrete product objects.
AbstractProduct
declares an interface for a type of product object.
ConcreteProduct
defines a product object to be created by the corresponding concrete factory.
implements the AbstractProduct interface.
Client
uses only interfaces declared by AbstractFactory and AbstractProduct classes.
Known cases
Look and Feel
Persistance Tier
UML
此模式经常与工厂模式和单例模式一同使用
代码: