Singleton
- 单例模式的类只提供私有的构造函数
- 类定义中含有一个该类的静态私有对象
- 该类提供了一个静态的公有的函数用于创建或获取它本身的静态私有对象
|
|
Reference
参考资料
- https://github.com/senghoo/golang-design-pattern/blob/master/03_singleton/singleton.go
- http://design-patterns.readthedocs.io/zh_CN/latest/creational_patterns/singleton.html#id19
- https://github.com/senghoo/golang-design-pattern
- https://github.com/faif/python-patterns
- https://sourcemaking.com/design_patterns
Author Houmin Wei
Publish February 11, 2023
LastMod August 27, 2026
License 本作品采用 CC BY-NC-ND 4.0 许可协议进行许可,转载时请注明原文链接
如果你在浏览博客的过程中发现了任何问题,欢迎在对应文章下评论。如果你有其他事情想要咨询,可以通过邮件联系我。
Linked Mentions