Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 0.37 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package {
  2.  
  3.    public final class Singleton {
  4.  
  5.       private static var instance:Singleton = new Singleton();
  6.  
  7.       public function Singleton() {
  8.          if( instance ) throw new Error( "Singleton and can only be accessed through Singleton.getInstance()" );
  9.       }
  10.  
  11.       public static function getInstance():Singleton {
  12.          return instance;
  13.       }
  14.    }
  15. }