What are the practical use differences between Flyweight vs Singleton patterns?

后端 未结 7 488
攒了一身酷
攒了一身酷 2021-02-04 01:50

The two pattern seems to achieve the same thing. What are the different use cases in real world? Thanks

7条回答
  •  终归单人心
    2021-02-04 02:36

    Don't forget that singleton is a creational pattern, while flyweight is a structural pattern. Hence, the goal of the two patterns is completely different

提交回复
热议问题