标签:
function c1(name){ this.name=name; this.hello=function(){ console.log(this.name); }; } c2.prototype=new c1(); function c2(name){ var params=Array.prototype.slice.call(arguments); c1.apply(this,params); //将this传递给父类 } var obj1=new c1(‘zy‘) var obj2=new c2(‘zyy‘); obj2.hello() obj1.hello();
标签:
原文地址:http://www.cnblogs.com/zyip/p/5022830.html