玩笑过后

导航

2018年9月5日 #

寄生组合式继承

摘要: <script> /* *寄生式继承 继承原型 *传递参数 subClass 子类 *传递参数 superClass 父类 */ //宿主 function inheritObject(o){ function fn(){} fn.prototype = o; return new fn } //继 阅读全文

posted @ 2018-09-05 16:09 玩笑过后 阅读(102) 评论(0) 推荐(0) 编辑

原型式继承

摘要: 二次封装 阅读全文

posted @ 2018-09-05 11:14 玩笑过后 阅读(83) 评论(0) 推荐(0) 编辑

组合继承

摘要: //父类 function superClass(name){ this.name = name; this.books = ['html','css','javascript']; } superClass.prototype.getName = function(){ console.log(this.name); ... 阅读全文

posted @ 2018-09-05 10:50 玩笑过后 阅读(61) 评论(0) 推荐(0) 编辑