go-pattern-examples/creation/02_simple_factory/README.md
2020-05-02 17:36:50 +08:00

7 lines
226 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 简单工厂模式
go 可以使用自定义的New()来初始化相关类。
New 函数返回接口时就是简单工厂模式也是golang一般推荐做法。
simplefactory包中只有Mouth接口和New()函数可见。