123456789101112131415161718192021 |
- "use strict";
- (function () {
- /**
- * 抽象类与其他类差别不大
- * abstract
- * 抽象类不是为了实例化对象
- * 它是因继承产生的类
- */
- class Animal {
- constructor(name) {
- this.name = name;
- }
- }
- class A extends Animal {
- eat() {
- console.log(this.name + "吃饱了");
- }
- }
- let aa = new A("妹妹");
- aa.eat();
- })();
|