个人学习笔记平台,欢迎大家交流

红叶~

Be humble, communicate clearly, and respect others.

摘要: 工厂模式 ​场景​:需要创建单一类型对象,且支持灵活扩展不同子类产品。 代码 // 抽象产品接口(定义产品规范)[1,3](@ref) interface Animal { void speak(); } // 具体产品实现类 class Dog implements Animal { @Overr 阅读全文
posted @ 2025-05-27 23:57 红叶~ 阅读(10) 评论(0) 推荐(0)