hey dudes and dudettes,

below is some MooTools syntax for doing Class style JS (inheritance
happens via the "Extends" property). my question: is there some jQuery
style way of doing this or should i just use some crockford or dean
edwards patterns using plain old js?

thanks in advance!



var Animal = new Class({
    initialize: function(age){
        this.age = age;
    }
});
var Cat = new Class({
    Extends: Animal,
    initialize: function(name, age){
        this.parent(age); //will call initalize of Animal
        this.name = name;
    }
});
var myCat = new Cat('Micia', 20);
alert(myCat.name); //Alerts 'Micia'.
alert(myCat.age); //Alerts 20.

Reply via email to