# A bug: singleton, helper class and vector?

**URL:** <https://forum.kirupa.com/t/a-bug-singleton-helper-class-and-vector/278035>\
**Category:** Uncategorized\
**Created:** [December 20, 2008, 5:56pm UTC](https://forum.kirupa.com/t/a-bug-singleton-helper-class-and-vector/278035 "2008-12-20T17:56:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felixz](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@Felixz](https://forum.kirupa.com/u/Felixz)\
**Post date:** [December 20, 2008, 5:56pm UTC](https://forum.kirupa.com/t/a-bug-singleton-helper-class-and-vector/278035/1 "2008-12-20T17:56:35Z")

</div>

I just wonder… Should this be roported to Adobe?

Current code gives a runtime error:

```auto
package {
 import flash.errors.IllegalOperationError;
 public class Singleton {
  private static const _Instance:Singleton = new Singleton();
  private var Helpers:Vector.<Helper> = new Vector.<Helper>();
  public static function get Instance():Singleton {
   return _Instance;
  }
  public function Singleton() {
   if (_Instance) throw new IllegalOperationError("Singleton class is a Singleton!");
  }
 }
}
class Helper {
 public function Helper() {
 }
}

```
