Mucking with Object's prototype is probably not a good idea.  The
toString() might impact other plain objects.

 

We don't get errors leaving "override" off unless we're subclassing
something other than Object like EventDispatcher or Sprite.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Kevin
Sent: Friday, March 21, 2008 10:10 AM
To: [email protected]
Subject: [flexcoders] Override toString() in Object not reccomened..
why?

 

I am wanting to override toString() in some objects of mine that
extend Object, however, I noticed this in the docs:

Note: Methods of the Object class are dynamically created on Object's
prototype. To redefine this method in a subclass of Object, do not use
the override keyword. For example, A subclass of Object implements
function toString():String instead of using an override of the base
class.

Should I just ignore this? I have been using the override keyword and
not had problems yet. Also if I DO NOT use it, I get compiler errors
saying I am trying to override a method not marked for override.

Thanks, Kevin

 

Reply via email to