0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

シングルトン とは

Posted at

勉強前イメージ

雰囲気、コード書くときのなんかやった気がする

調査

シングルトン とは

英語でsingletonと書き、オブジェクト指向のプログラミング時のクラスのデザインパターンの一種になります。

デザインパターンとはオブジェクト指向の言語で使われる設計のパターンで
設計のときによく直面する問題とその解決策を整理してまとめたものを指します。

シングルトンはクラスを設計するときの設計の方法の一つということです。
その中でも、クラスのインスタンスを2つ以上作成出来ないようにすることで常に同一のインスタンスが参照されるデザインパターン(設計)になります。
プログラム中でインスタンスの状態を常に持っておきたい場合や、クラス端で共通のデータとしてアクセスする必要がある場合に使われます。

勉強後イメージ

全然コード書かないからわからないけど
このインスタンスしか参照されないようにって1つだけ置いておくってことかな?

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?