How to implement singleton without using static/global variable? Possible?

前端 未结 3 2019
半阙折子戏
半阙折子戏 2021-01-06 19:08

How to implement singleton without using static/global variable? Possible?

This is an interview question...

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 19:23

    Dependency injection is one possibility. Since your question is not specific to any programming language, I am not posting framework specific syntax (such as Ninject)

提交回复
热议问题