class Parent{
constructor(){
this.name = 'parent';
this.age = 88;
}
say(){
console.log('hello parent');
}
static qqq = 666;//想给Parent设置一个私有属性,用static,这样child.qqq 也是可以调用到的
}
class Child extends Parent{
constructor(){
super();//写了extends 和constructor;则必须写super()
//super其实就是Parent的constructor
this.money = 100;
}
play(){
console.log('child play')
}
}
var xm = new Child();
console.log(xm);