//Person人类 - 父类
function Person(name) {
this.name = name
}
Person.prototype.eat = function () {
console.log(this.name,'吃饭')
}
//Student学生类 -子类
function Student(num,name) {
Person.call(this,name)
this.num = num
}
//原型继承 - 父类实例对象赋值给子类原型
Student.prototype = new Person()
// let s1 = new Student(1001)
let s1 = new Student(1001,'rose')
s1.eat()
console.log(s1.name);