class MainClass {
constructor() { }
Metod1(){
console.log('MainClass.Metod1()');
}
Metod2 = () => console.log('MainClass.Metod2()');
}
class СhildClass extends MainClass {
constructor() {
super();
}
Metod1(){
console.log('СhildClass.Metod1()');
}
Metod2() {
console.log('СhildClass.Metod2()');
}
}
let child = new СhildClass();
child.Metod1(); // => СhildClass.Metod1()
child.Metod2(); // => MainClass.Metod2()
Why method2 is called from parent class?
If you rewrite a method in a child class using an arrow function, it will be overridden. Where can I read about this?