super question

Jeff Dyer jodyer at adobe.com
Fri Jun 8 11:04:48 PDT 2007


Super expressions limit references to names in the base class only, not the
prototype. To do what you want you¹ll need to use a reference to
Œconstructor.prototype.formatValue()¹.

Jd

On 6/8/07 10:49 AM, Kris Zyp wrote:

> I was wondering if the super keyword causes base limiting only in classes, or
> in delegate chains as well. For example:
> function MyObj() { }
> MyObj.prototype.formatValue = function() { return "value: " + this.value };
> var myObj = new MyObj;
> myObj.value = 10;
> myObj.formatValue = function() { return "The value is: " +
> super.formatValue(); }
>  
> If I called myObj.formatValue() would it go up the delegate chain to call a
> super formatValue? Would calling myObj.formatValue() return "The value is:
> value: 10" (as it would seem logical to me that it would)? Or does super only
> apply to super/sub classes?
> Thanks,
> Kris
> 
> 
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20070608/c6d75276/attachment-0002.html 


More information about the Es4-discuss mailing list