1. 首页
  2. 音视频
  3. 图像处理
  4. 基于构造函数的五种继承方法小结

基于构造函数的五种继承方法小结

上传者: 2020-12-13 08:27:46上传 PDF文件 28.6KB 热度 11次
1.使用call或apply绑定构造函数 animal.apply(this.arguments) 2.使用prototype属性 Cat.prototype = new Animal(); Cat.prototype.constructor = Cat; var cat1 = new Cat("大毛","黄色"); alert(cat1.species); // 动物 3.直接集成prototype属性 function Animal(){ } Animal.prototype.species = "动物"; Cat.protot
下载地址
用户评论