正在加载中

最后更新于 2018年07月28日

代码部分:

function Box(name) {
     this.name = name;
     this.famil = ['爷爷','奶奶','爸爸','妈妈'];
};
Box.prototype.run = function() {
     return this.name + this.famil;
};
function Desk(name) {
    Box.call(this,name);
};
Desk.prototype = new Box();

通过对象仿冒,将Box的属性仿冒到Desk中,这样就可以传入参数,也可以算是继承了,但是后面我们又通过Desk的原型继承了Box,那么Box中的实例属性和原型都会被继承到,那么其中的实例属性我们已经通过仿冒了,难道不会冲突吗?

  • weixiao kaixin tushetou jingkong deyi fanu liezui liuhan daku ganga bishi nanguo lihai qian yiwen numu tu yi haixiu se fadai minyan hehe henkaixin huaji biyiyan kuanghan maimeng shui xiaku penqi zhangzui pen aini ye niu laji ok chigua renshi kongbu shuai xiaoxiese touxiao huaixiao jingnu chihuai kaisang xiaoku koubi zhuangbi lianhong kanbujian shafa zhijing xiangjiao dabian yaowan redjing lazhu rizhi duocang chixigua hejiu xixi xiaopen goukun xiaobuchu shenme wusuowei guancha lajing chouyan xiaochi bie zhadanzui zhadanxiao