객체지향4. ES6방식으로 안쉽게 구현하는 상속기능 (class) 수업 중
class Parent {
constructor(name) {
this.name = name;
}
sayHi() {
console.log('hello')
}
}
이렇게 sayHi라고 function을 클래스내에서 선언을 할 경우에는 Parent.prototype에 들어가는걸 확인할 수 있었는데요,
만약 저 sayHi 를 sayHi = function () { console.log('hello') }
로 선언을 해버리면 constructor()외부에서 선언된 함수임에도 불구하고, 자식에게 드대로 상속이 되더라구요. 이런 이유는 왜 그런가요?

