class Parent {
constructor(x) {
this.x = x;
}
present() {
return `I have a ${this.x}`;
}
}
class Child extends Parent {
constructor(x, y) {
super(x);
this.y = y;
}
present() {
return `${super.present()}, it is a ${this.y}`;
}
}
child = new Child("Tinggu", "Winggu");
console.log(child.present()); // invokes the child version
How would I invoke the parent's method, from the child object? Type-Casting like Java doesn't seem to help.