반응형
package {
public class MyClass {
private static var _instance:MyClass
public function MyClass(enforcer:SingletonEnforcer) {
}
public static function getInstance():MyClass {
if(MyClass._instance == null) {
MyClass._instance = new MyClass(new SingletonEnforcer());
}
}
}
}
class SingletonEnforcer {}
var instance:MyClass = MyClass.getInstance();