sitelink1  
sitelink2  
sitelink3  
sitelink4 http://1 
extra_vars4 ko 
extra_vars5 http://www.taeyo.net/Forum/Content.aspx?SEQ=21743&TBL=JSCRIPT&PGN=1 
extra_vars6 sitelink1 
1. 첫번째 질문

  1. /*부모클래스*/     
  2. function NxControl(containerElement) {   
  3.    this.GetText=function()  {   
  4.       return "부모입니다.";   
  5.   }   
  6. }   
  7.   
  8. /*----------------------------------------------------------------*/
    /*NxControl을 상속받은 자식 클래스*/  
  9. function NxViewer(containerElement) {   
  10.    NxControl.apply(this, arguments);   
  11.    this.GetText=function()  {   
  12.      return "자식입니다.";   
  13.    }   
  14. }   
  15. NxViewer.prototype = new NxControl();   
  16. /*----------------------------------------------------------------*/  
위와 같은데요.
NxViewer 에서 NxControl 의 GetText()를 호출하고 싶습니다.

·미리보기 | 소스복사·
  1. NxViewer.prototype = new NxControl();   
  2. NxViewer.prototype.constructor = NxViewer;  
상속은 위와 같이 합니다.
흔히들 두번째, 생성자를 재지정하는 걸 놓지는데 반드시 생성자를 재지정 해야 합니다.
만약 재지정하지 않을 경우 var o = new NxViewer() 와 같이 생성한 객체가 가르키는 constructor가 부모 생성자가 되어버리는 문제가 생깁니다.
이렇게 하였을 경우 부모의 GetText()를 호출 하는 방법은 아래와 같습니다.
·미리보기 | 소스복사·
  1. var o = new NxViewer();   
  2. alert(o.constructor.prototype.GetText());  
프로토타입 체인을 이해하시면 될거 같습니다.


2. 두번째 다시 질문

답변 감사합니다.
아래와 같이 코딩했더니

·미리보기 | 소스복사·
  1. /*부모클래스*/    
  2.  function NxControl(containerElement)   
  3. {      
  4.     this.GetText=function()     
  5.    {         
  6.       alert( "부모입니다.");     
  7.    }   
  8. }   
  9. /*----------------------------------------------------------------*/  
  10. /*NxControl을 상속받은 자식 클래스*/  
  11. function NxViewer(containerElement)   
  12. {      
  13.     NxControl.apply(this, arguments);      
  14.     this.GetText=function()     
  15.    {        
  16.        alert( this.constructor.prototype.GetText() );   
  17.    }   
  18. }   
  19. NxViewer.prototype = new NxControl();   
  20. NxViewer.prototype.constructor = NxViewer;   
  21. var ctl = new NxViewer();   
  22. ctl.GetText();  

"부모입니다" 가 찍히긴 하는데요. 연이어 'undefined' 앨럿창도 떠버리네요.
'undefined' 가 안뜨게 할 수 있는 방법이 있을까요? ^^

리턴값이 존재 하지 않아서 뜨는 문제 입니다.
아래 참고 하세용.
·미리보기 | 소스복사·
  1. /*부모클래스*/    
  2.  function NxControl(containerElement)   
  3. {      
  4.     this.GetText=function()     
  5.    {         
  6.       //alert( "부모입니다.");     
  7.      return "부모값";  
  8.    }   
  9. }   
  10. /*----------------------------------------------------------------*/  
  11. /*NxControl을 상속받은 자식 클래스*/  
  12. function NxViewer(containerElement)   
  13. {      
  14.     NxControl.apply(this, arguments);      
  15.     this.GetText=function()     
  16.    {        
  17.        alert( this.constructor.prototype.GetText() );   
  18.    }   
  19. }   
  20. NxViewer.prototype = new NxControl();   
  21. NxViewer.prototype.constructor = NxViewer;
    var ctl = new NxViewer();   
  22. ctl.GetText();  
... 음
번호 제목 글쓴이 날짜 조회 수
97 이미지 로드 코드 황제낙엽 2009.06.27 18
96 자동 형변환 (문자열 -> 숫자) 황제낙엽 2009.06.25 124
95 자바스크립트 쿠키 황제낙엽 2009.06.11 15
94 이클립스에 Aptana 플러그인 설치하기 (자바스크립트 개발에 유용한 IDE) 황제낙엽 2009.04.17 75
93 [JavaScript Tutorials] Error handling in JavaScript using try/catch/finally - The Error object and throwing your own errors (해석중) 황제낙엽 2009.04.10 82
92 [JavaScript Tutorials] More leakage patterns (해석중) 황제낙엽 2009.04.10 142
91 [JavaScript Tutorials] Introducing the closure (해석중) 황제낙엽 2009.04.10 555
90 [JavaScript Tutorials] JavaScript and memory leaks (해석중) 황제낙엽 2009.04.08 102
89 [JavaScript Tutorials] Handling runtime errors in JavaScript using try/catch/finally (해석중) 황제낙엽 2009.04.08 2784
88 JavaScript Closures for Dummies 황제낙엽 2009.04.08 227
87 테이블 엘리먼트 생성 스크립트 황제낙엽 2009.04.07 14
86 MS 익스플로러상에서 문제가 되는 Leak 모델 황제낙엽 2009.04.03 171
85 잘못된 종속관계 해지에 따른 메모리 누수 예제 황제낙엽 2009.04.03 41
84 [펌] TAEYO.NET - Js OOP - 나만의 프레임워크 만들기 황제낙엽 2009.04.02 18
83 [펌] TAEYO.NET - Js OOP - 사용자 정의 객체. 그리고 상속과 재사용 황제낙엽 2009.04.02 16
82 [펌] TAEYO.NET - JavaScript OOP 코어객체와 prototype를 사용한 객체확장 황제낙엽 2009.04.02 21
81 [펌] TAEYO.NET - JavaScript OOP 스트레칭 황제낙엽 2009.04.02 27
80 [펌] 아사페릴의 사생활 - 싱글톤 패턴을 지향한 Javascript Module Pattern 황제낙엽 2009.04.02 90
79 [펌] 아사페릴의 사생활 - Code Conventions for the JavaScript Programming Language 황제낙엽 2009.04.02 194
78 [펌] 아사페릴의 사생활 - __proto__ 와 construct 와 prototype 황제낙엽 2009.04.02 23