Singleton ãã¿ã¼ã³ï¼ã·ã³ã°ã«ãã³ã»ãã¿ã¼ã³ï¼ã¨ã¯ããªãã¸ã§ã¯ãæåã®ã³ã³ãã¥ã¼ã¿ããã°ã©ã ã«ãããããã¶ã¤ã³ãã¿ã¼ã³ã®1ã¤ã§ãããGoF (Gang of Four; 4人ã®ã®ã£ã³ã°ãã¡) ã«ãã£ã¦å®ç¾©ããããSingleton ãã¿ã¼ã³ã¨ã¯ããã®ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã1ã¤ããçæãããªããã¨ãä¿è¨¼ãããã¶ã¤ã³ãã¿ã¼ã³ã®ãã¨ã§ããããã±ã¼ã«ãã«ãã¯ã»ã¢ã³ãã»ãã£ã¼ã«ãªã©ã絶対ã«ã¢ããªã±ã¼ã·ã§ã³å ¨ä½ã§çµ±ä¸ããªããã°ãªããªãä»çµã¿ã®å®è£ ã«ä½¿ç¨ããã[1]ã Singleton ãã¿ã¼ã³ã®ä¸è¬çãªã¯ã©ã¹å³ã示ãã Singleton ã¯åãåã®ã¤ã³ã¹ã¿ã³ã¹ã private ãªã¯ã©ã¹å¤æ°ã¨ãã¦æã¤ããã®å¤æ°ã«ã¯ Singleton.getInstance() ããã¢ã¯ã»ã¹ãããSingleton ã®ã³ã³ã¹ãã©ã¯ã¿ã¯ private ã§ããã ãã®ã¯ã©ã¹å³ã§æ³¨ç®ãã¹ããã¨ã¯ä»¥ä¸ã®3ç¹ã§ã
{{#tags}}- {{label}}
{{/tags}}