mySuperClass = Class.create();
mySuperClass.prototype =
{
initialize: function(id)
{
this.id = id;
},

doSomething: function()
{
alert(this.id + " base doSomething()");
}
};

mySubClass = Class.create();
mySubClass.prototype =
{
initialize: function(id)
{
//cache the base class instance
this.base = new mySuperClass(id);

//inherit from the base class
Object.extend (this, this.base);

//override methods
this.doSomething = function()
{
alert(this.id + " overridden doSomething()");
this.base.doSomething ();
};
}
};

On 9/12/06, Sébastien Gruhier <[EMAIL PROTECTED]> wrote:

Hi

Is there a way to extend a class and to overide a method and, in this
method, to call the parent function as it is done in mootools?
Thanks
Seb


Athena Group, Inc.
Inquire: 1-888-919-8700 x2903
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to