1234567891011121314151617181920212223 |
- "use strict";
- (function () {
- /**
- * abstract 与 其他类大差不差
- * 不是为了实例化对象
- * 是因为继承才产生的类
- * 抽象类中方法没用具体内容 只有方法体
- * 在继承中写具体方法
- */
- class Toy {
- constructor(name) {
- this.name = name;
- }
- }
- class A extends Toy {
- say() {
- console.log(this.name + '说你好');
- }
- }
- let a = new A("迪迦奥特曼");
- console.log(a);
- a.say();
- })();
|