classAnimal{constructor(name){this.name = name;}sayHi(){return`My name is ${this.name}`;}}let a =newAnimal('Jack');console.log(a.sayHi());// My name is Jack
继承
使用 extends关键字实现继承,子类中使用super 关键字来调用父类的构造函数和方法。
classAnimal{public name:stringconstructor(name){this.name = name;}sayHi(){return`My name is ${this.name}`;}}classCatextendsAnimal{constructor(name:string){super(name);// 调用父类的 constructor(name)}sayHi(){return'Meow, '+super.sayHi();// 调用父类的 sayHi()}}
classAnimal{public name;publicconstructor(name){this.name = name;}}let a =newAnimal('Jack');console.log(a.name);// Jack
a.name ='Tom';console.log(a.name);// Tom
abstractclassAnimal{public name;publicconstructor(name){this.name = name;}publicabstractsayHi();}classCatextendsAnimal{publicsayHi(){// 实现抽象类的抽象方法console.log(`Meow, My name is ${this.name}`);}}let cat =newCat('Tom');
前一篇文章KnowStreaming系列教程第二篇——项目整体架构分析_诸葛子房_的博客-CSDN博客
讲述了KS的整体项目目录,这边文章来讲述下KS在调度模块里面对于指标采集和元数据同步
一、调度模块代码主要在km-task里面
public class TaskClusterAddedListener impleme…