function Person(name){
  this.name=name;
}

function Student(name,className){
  this.className=className;
  Person.call(this,name);//调用别的构造器   
}

var mike=new Student('mike','Network3');

//子类调用已被覆盖的父类的方法
Person.prototype.init=function{
...
}
Student.prototype.inti=function{
  Person.prototype.init.apply(this,arguments);    
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-30
  • 2021-07-24
  • 2021-05-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案