BatMobile = Class.extend(
/* prototype props: */ {
init: function(owner) {
this.owner = owner;
this.currenLocation = 'Waynes house',
this.maxSpeed = 300
}
},
/* static props: */ {
getManufacturer: function() {
return 'Made in China';
},
copyright: 'Wayne Inc.'
}
);
BatMoto = BatMobile.extend({
init: function (owner) {
// Вызов родительского конструктора
this.super.init.apply(this, arguments);
this.maxSpeed = 400;
}
});
// Можем применить mixin даже после наследования,
// И этот метод всё равно будет доступен потомку
BatMobile.mixin({
goTo: function(location) {
this.currenLocation = location;
}
});