摘要: 原文链接:http://js8.in/698.html.构造函数继承:第一种方法是使用prototype属性:这里也可以直接Child.prototype=new P();考虑到P构造函数的参数无法确定,所以使用一个空函数。function extend(Child,Parent){ var F=function(){}; F.prototype=Parent.prototype; Child.prototype=new F(); Child.prototype.constructor=Child;}第二种方法则是属性和方法的拷贝:function extend(Chi... 阅读全文
posted @ 2013-07-01 15:45 xmlovecss 阅读(366) 评论(0) 推荐(0) 编辑