export class BaseClass{
constructor()
{
console.log('Base Constructor');
}
}
export class ChildClass extends BaseClass
constructor() {
super();
console.log('Child Constructor');
}
}
Result:
Base Constructor
Child Constructor
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.
No comments:
Post a Comment