You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
413 B

// 成员可见性:让父类的方法或属性让子类成员可以使用
// 可见性修饰符: public,表示公开的、公有的,公有成员可以被任何地方访问。public 是默认可见性,可以省略。
// 父类
class Animal {
public move() {
console.log('123')
}
}
// 子类
class Dog extends Animal {
bark() {
console.log('88888')
}
}
const d = new Dog()