Yes sure, you can call any method with super, but the syntax is "this._super().method()".
If you are in the "someFunction()" method and you call "this._super().someFunction()" it will call the next "someFunction" method up in the class hierarchy, but if you are in the "someFunction()" method and call "this._super().anotherFunction()" it will call the latest implementation of "anotherFunction" method. It works exactly as Java. On Fri, Apr 24, 2009 at 8:44 PM, Jeremy Thomerson <[email protected]> wrote: > Does it only apply to attributes then? Can you still call the super's > functions? How do I do this? > > function someFunction() { > addMoreFunctionality(); > super.someFunction(); > } > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > > On Fri, Apr 24, 2009 at 6:37 PM, Eduardo Nunes <[email protected]> wrote: >> uhmm, why do you think it is pretty big? I shouldn't use >> super.attribute, you can use this.attribute instead. >> For example: >> >> var Shape = Class.extend({ >> height: 0, >> width: 0, >> init: function(height, width) { >> this.height = height; >> this.width = width; >> }, >> info: function() { >> alert("I have height = " + this.height + >> " and width = " + this.width); >> } >> }); >> >> var Rectangle = Shape.extend({ >> info: function() { >> alert("I'm a rectangle and I have height = " + this.height + " and >> width = " + this.width); >> // you can't do this.super().height, because this makes the method >> accessor counter gets lost. >> } >> }); >> >> All attributes from the super class are copied to the new class. >> >> On Fri, Apr 24, 2009 at 8:07 PM, Jeremy Thomerson >> <[email protected]> wrote: >>> Looks nice, but: >>> >>>> Limitations >>>> >>>> It's not possible to access an attribute through the super function. >>> >>> That seems pretty big. Do you plan on adding that? >>> >>> -- >>> Jeremy Thomerson >>> http://www.wickettraining.com >>> >>> >>> >>> >>> On Fri, Apr 24, 2009 at 5:47 PM, Eduardo Nunes <[email protected]> wrote: >>>> Hello guys, >>>> >>>> I'm not used to develop in Javascript but, as a fan of programming >>>> languages and object-oriented paradigm, my friend Otavio Avila and I >>>> decided to develop a kind of inheritance in JavaScript. He is a very >>>> experienced javascript developer and html coder, with helped me a lot >>>> with my lack of knowledge in these areas. You can check more about it >>>> in http://jsii.googlecode.com. The project is licensed in LGPL that >>>> enables you to use it in your commercial, or not, applications. >>>> I think it could help to make more complex things with javascript. >>>> >>>> Thanks, >>>> Eduardo S. Nunes >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
