안녕세계
[JavaScript] Inheritance Mechanism (상속 메커니즘)
기존연결 ㅡ 끊은연결 ㅡ 새로연결 ㅡ [inheritance.js] function Parent(){} function Child(){ this.superconstructor(); // Parent() scope 생성 } Child.prototype = new Parent(); Child.prototype.constructor = Child; Child.prototype.superconstructor = Parent; var obj = new Child(); [자바스크립트 상속 메커니즘] 1) 모든 함수는 Function 객체의 prototype 멤버를 상속 2) 모든 함수의 prototype 객체는 Object 객체의 prototype 객체를 상속 3) 모든 생성자 함수의 객체는 object 객체의 p..
Language/JavaScript
2016. 7. 18. 20:21