【design pattern】factory pattern

参考

https://sourcemaking.com/design_patterns/factory_method/java/1

定义

deal with the problem of creating objects without having to specify the exact class of the object that will be created.

解决的问题是:不需要确定具体的对象类型,就能创建对象。

简述

定义一个接口interface:I,实现这个接口的类:C1,C2,C3.不同的类处理不同的场景。

示例

见链接

Android中的使用