Singleton

Programming/Design Patterns 2007. 2. 21. 11:08
 1 class Singleton{
2         private static var uniqueInstance;
3
4         private function Singleton(){
5
6         }
7         public static function getInstance():Singleton{
8                 if(uniqueInstance == null){
9                         uniqueInstance = new Singleton();
10                 }
11                 return uniqueInstance;
12         }
13         public function getName(){
14                 trace("Singleton pattern");
15         }
16 }
    

설정

트랙백

댓글