Hans Wichman wrote:
> lets say i have a superclass:
> 
> class SuperClass {
>  private var _test:String = null;
> }
> 
> and a subclass:
> 
> class SubClass {
>     private function _testFunction () {
>       super._test = "foo";
> trace (super._test);
> }
> }
> 
> 
> this traces undefined.
> 
> If I remove the super. it works, but I like to know when I'm referencing
> super class fields.

Actually, you're not referring to a superclass field in this instance. Your
subclass inherits all the methods and variables of the superclass, so _test
is a member of the object you create using SubClass.

You need to use super when you have overridden a method or variable. For
example, if you have an Init() method in both, and you want to run the
superclass's Init() first, you would call super.Init();

Otherwise, you treat inherited methods and vars as if they were part of the
subclass--which they are. They're just inherited, not declared.

Cordially,

Kerry Thompson


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to