function human(name,age){
this.name=name
this.age=age
}
human.prototype.chifan=function(){
console.log(this.name+"正在吃饭")
}
human.prototype.shuijiao=function(){
console.log(this.name+"正在睡觉")
}
function Student(name,age){
human.call(this,name,age)
}
Student.prototype.tingke=function(){
console.log(this.name+"正在听课")
}
Student.prototype=new human()
var S1=new Student("小明",8)
console.log(S1) // 显示:小明 8
console.log(S1.chifan()) //显示:小明正在吃饭