😽

シングルトンパターン

2021/05/24に公開約200字

The class is instantiated only once, irrespectively of the number of instantiation requests.

  • private constructor: the class cannot be instantiated directly
  • class-level attribute: refers to one instance
  • class-level method for serving the instantiation requests:
    it returns an instance

Discussion

ログインするとコメントできます