示例中利用 $.extend(true,.,.);的方法, 让Test1.Say方法扩展到Test1上实现集成.
function Test1() {
Test1.prototype.Say = function () {
alert(1);
}
}
function Test2() {
Test2.prototype = $.extend(true, Test2.prototype, Test1.prototype);
}
var t1 = new Test1();
var t2 = new Test2();
alert(t1.Say === t2.Say)//true;