:
function Parent() {}
function Child() {
Parent.call(this);
}
var Constr = function() {};
Constr.prototype = Parent.prototype;
Child.prototype = new Constr();
Child.prototype.constructor = Child;
, "" , Parent.prototype Child.
, Child.prototype Parent.prototype.
. , , . call [docs] apply [docs ], this, .
:
function Employee(name,title){
this.title=title;
Person.call(this, name);
}
.
this.base(name), , ( ), this .
, , . Google Closure library:
goog.inherits = function(childCtor, parentCtor) {
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
childCtor.prototype.constructor = childCtor;
};