I have two classes. The class Two must extend from One. Both have method with the same name which do different console.logs. How to first console.log ('Hey from class One!') and then console.log('Hey from class Two!') by calling newTwo.hey()? I only get 'Hey from class Two!';
class One{
sayHey() {
console.log('Hey from class One!');
}
}
class Two extends One{
constructor() {
super();
}
sayHey() {
console.log('Hey from class Two!');
}
}
const newOne = new One();
const newTwo = new Two();
newTwo.sayHey();