They would be the same.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of lytvynyuk
Sent: Tuesday, March 25, 2008 12:21 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Singletone class in Application and Modules !?

 

Is it true if I have singleton class instantiated in main application
and in module, instances will be different?

    public class DataManager
    {
        private static const singleton_:DataManager = new DataManager();
        
        public static function get instance():DataManager {
            return singleton_;
        }
        
        public function DataManager() {
            if (singleton_ != null) {
                throw new Error("Cannot instantiate singleton
DataManager");
  !          }
        }
    }

in main application:

      private function init():void {
          this.dataManager = DataManager.instance;
      }

in module 

      private function init():void {
          this.dataManager = DataManager.instance;
      }

 

Reply via email to