摘要:
复制继承:简单理解,就是把父对象上的所有属性复制到自身对象上; function Cat(){ this.climb = function(){ alert("我会爬树"); ... 阅读全文
摘要:
关键代码 this.parent = Cat; this.parent.apply(this); 1 function Cat(){ 2 this.climb = function(){ 3 al... 阅读全文
摘要:
有一只小狗叫花花,它会“汪汪”叫,他的同伴也会汪汪叫,后来环境发生了变化,新出生的狗不会再“汪汪”叫,而变成“呜呜”叫。试通过继承来达到目的 1 function Dog(){ 2 2 this.bark = function(){ 3 3 ... 阅读全文