C++ singleton vs completely static object

前端 未结 5 512
陌清茗
陌清茗 2020-12-13 00:12

Let say we need to have just one instance of some class in our project. There are couple ways of doing it.

I want to compare. Please can you review my understanding.

5条回答
  •  庸人自扰
    2020-12-13 01:11

    You might add: static objects can throw exceptions. The executable will not to start and it's difficult to debug/handle well.

提交回复
热议问题