Purely pedantic, but the code does not do anything to 'enforce' the
singleton-ness of the class.

It should actually be:
public function Singleton(e:SingletonEnforcer){
  if(e != null)
  {
     trace("new instance of singleton created");
  }
}

On Mon, Nov 16, 2015 at 12:54 AM, yishayw <yishayj...@hotmail.com> wrote:

> Actually the comment above 'class SingletonEnforcer' explains it.
>
> package{
>     public class Singleton{
>         private static var _instance:Singleton=null;
>         public function Singleton(e:SingletonEnforcer){
>             trace("new instance of singleton created");
>         }
>         public static function getInstance():Singleton{
>             if(_instance==null){
>                 _instance=new Singleton(new SingletonEnforcer());
>             }
>             return _instance;
>         }
>     }
> }
> //I’m outside the package so I can only be accessed internally
> class SingletonEnforcer{
> //nothing else required here
> }
>
>
>
> --
> View this message in context:
> http://apache-flex-development.2333347.n4.nabble.com/FlexJS-FalconJX-Internal-Classes-tp50091p50102.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Reply via email to