Created
May 2, 2011 22:06
-
-
Save Nutrox/952470 to your computer and use it in GitHub Desktop.
Easy Singleton Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
public class Singleton | |
{ | |
static public const instance:Singleton = new Singleton(); | |
public function Singleton() | |
{ | |
if( instance ) | |
{ | |
throw new Error("Singleton class cannot be instantiated"); | |
} | |
} | |
}// EOC | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment