JS---子类调用父类的方法


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);    
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM