class Base{ x: number;
constructor() {
// return a new object other than `this`return {
x: 1,
};
}
}class Derived extends Base {
constructor() {
super();
} public ShowValue(){ this.x; }
}
By using the super keyword we can call base class constructor.
In Child class constructor super should be the very first statement.
If you want to wait till for some operation will be done then child class
constructor call. Then we can use super.