Subj : Re: accessing methods of base class To : netscape.public.mozilla.jseng From : =?ISO-8859-1?Q?Georg_Maa=DF?= Date : Thu Jul 17 2003 08:01 pm mike caines wrote: > Referring to example: > > function One() { > this.toString = function() {return 'One';}; > } > > function Two() { > One.apply(this); > this.toString = function() {return + '\n' + > 'Two';} > } > Two.prototype = new One(); > > > Is it somehow possible to access the original toString method of the base > class once it has been overridden? So that the overriding version can > 'append' to the original? (see example). > > Also, doesn't the Two.prototype = new One(); statement result in the One > constructor being executed twice? > > Thank you. > > Each function is an object. You can use this to store a reference to te original inside the overwriting function before you overwrite the original. -- Georg Maaß - bioshop.de D-93466 Chamerau, Roßbergweg 42 JavaScript, C++ Engineering - The ultimative DHTML engine: http://gml-modul.sourceforge.net - http://sourceforge.net/projects/gml-modul .