Closed
Description
A call to super multiple times in Child class' constructor does not give any error, is it expected behavior? Dose it initiate multiple parent objects?
class E {
name:string;
constructor(theName: string,age:number) {
this.name = theName;
console.log("E constrcutor");
}
displayName():void {
console.log(" Name = " + this.name);
}
}
class F extends E {
name:string;
constructor(theName: string) {
this.name = theName;
console.log("F constrcutor");
super(theName,4);
super("Hello",5); // No error here
}
}
let e: E = new E("E",1);
let f: F = new F("F");
f.displayName(); // return "Hello"