Are Static Members Inherited?

Garrett Smith dhtmlkitchen at gmail.com
Sat Aug 18 01:08:59 PDT 2007


> Static properties are in scope of bodies of static and instance
> methods of the same class.
> Instance properties are in scope of the bodies of the instance
> methods. Instance properties
> shadow static properties with the same name. Static properties of base
> classes are in
> scope of static and instance methods of a class.

>> class C extends A { function m() { print( ax ); } }
>> new C().m()
20

Ah, I see, so the static properties of the superclass are visible in
the scope chain, but not on the instance:

>> class D extends A { function md() { print( this.ax ); } }
>> new D().md()
undefined

and not even through the subclass's constructor:
>> class E extends A { function me() { print (this.constructor.ax); } }
>> new E().me();

Right?



More information about the Es4-discuss mailing list