The shortest Singleton declaration!


public class Singleton {

static private var _instance:Singleton;

static public function getInstance():Singleton {

/// return _instance || ( _instance = new Singleton( new key() ) );

return _instance ||= new Singleton( new key ) ;

}

public function Singleton(singleton:key){}

}

class key{}

Thanks to John Lindquist for the fix, haha.

Advertisements