function Employee() {
}
const emp1 = new Employee();
class People {
constructor(name, age) {
this.name = name;
this.age = age;
}
say() {
console.log("我的名字叫:", this.name);
}
}
// const p1 = new People("黄大", 167);
// p1.say()
class Student extends People {
constructor(name, age, clas) {
super(name, age)
this.clas = clas;
}
sayCalss() {
console.log('我是' + this.clas + "年级的" + this.name);
}
}
const s1 = new Student('野原新之助', 18, 6);
s1.say()
s1.sayCalss()
function onPrintClick() {
s1.say()
s1.sayCalss()
console.log("Student.prototype.__proto__ === People.prototype:", Student.prototype.__proto__ === People.prototype);
}
// Student.prototype.__proto__ === People.prototype // true