摘要: 与类的创建篇一样,这里先贴出最终代码,再做详细分析:// 创建一个父类function SuperType(){ this.company = 'alibaba';}function SubType(){ SuperType.call(this); // 【1. 调用父类的构造函数】 this.name = 'yunos'; }SubType.prototype = Object.create(SuperType.prototype,{constructor:{value:SubType}}); // 【2. 把父类的原型赋给子类】var instance = 阅读全文
posted @ 2013-08-31 15:50 花落红尘 阅读(266) 评论(0) 推荐(0) 编辑