목록2008/05/27 (1)
psycoder
[Psycoder] Singleton Design Patterns
그냥 간단히 소개해 볼까 한다. (허접이겠지만.) Singleton패턴 단 하나의 인스턴스만 생성하는것!! 간단하지 않은가?? ㅋㅋㅋ 자세히 말하자면 전역변수와 같이 어디서든지 유일한 인스턴스에 접근하여 사용한다는 패턴인거다. Example public class Singleton { private static Singleton singleton; private Singleton() { } //end of constructor public static Singleton getInstance() { if(Singleton == null) singleton = new Singleton(); return singleton; } //end of method } // end of class 참고 사이트: http..
Design Patterns
2008. 5. 27. 22:27