Class.create() is used to create a new class, and invoke the initialize() method of the created class.
Compare this regular class creation:
MyClass = function() {}
MyClass.prototype.initialize = function(a, b) {
this.a = a;
this.b = b;
}
var mc = new MyClass();
mc.initialize("foo", "bar");
with this one using Class.create:
MyClass = Class.create();
MyClass.prototype = {
initialize: function(a, b) {
this.a = a;
this.b = b;
this.secondfunc();
},
secondfunc: function(){
this.t = 'secondlife';
}
}
var mc = new MyClass("foo", "bar");
alert(mc.t)
Inheriting
(to be continued)