v

[ActionScript 3.0] Singleton , 싱글톤 페턴

package {
    public class Singleton {
        private static var instance:Singleton;
        private static const checker:Object = {};
 
        public function Singleton(initObj:Object) {
            if(initObj != checker) {
                throw new Error("Private constructor!");
            }
        }
 
        public static function getInstance():Singleton {
            if(instance == null) {
                instance = new Singleton(checker);
            }
            return instance;
        }
    }
}
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 2,472
14년 전 조회 884
14년 전 조회 2,833
14년 전 조회 1,233
14년 전 조회 1,574
14년 전 조회 4,895
14년 전 조회 1,649
14년 전 조회 816
14년 전 조회 627
14년 전 조회 1,763
14년 전 조회 849
14년 전 조회 1,223
14년 전 조회 734
14년 전 조회 725
14년 전 조회 814
14년 전 조회 4,591
14년 전 조회 1,491
14년 전 조회 839
14년 전 조회 2,096
14년 전 조회 1,569
14년 전 조회 1,399
14년 전 조회 2,826
14년 전 조회 1,932
14년 전 조회 919
14년 전 조회 1,020
🐛 버그신고