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();  
... 음
번호 제목 글쓴이 날짜 조회 수
117 User Agent 관련 Reference URL 황제낙엽 2011.02.22 41
116 각 브라우저 별 User Agent 정보 황제낙엽 2011.02.22 823
115 History of User Agent 황제낙엽 2011.02.22 38
114 Navigator 객체란? 황제낙엽 2011.02.22 53
113 Understanding User-Agent Strings 황제낙엽 2011.02.22 76
112 User Agent 정보 모음 file 황제낙엽 2011.02.22 7768
111 ActiveX 설치 여부를 검사하는 스크립트 황제낙엽 2011.02.13 4053
110 자바스크립트 예약어 황제낙엽 2010.11.03 35
109 YUI Logger(Yahoo) 를 동적으로 로드하는 북마크릿 황제낙엽 2010.10.03 25
108 Javascript 를 사용하여 Binary File 읽기 황제낙엽 2010.09.29 500
107 크로스 브라우저를 위한 브라우저 검사 코드 file 황제낙엽 2010.08.27 86
106 Dynatrace For Ajax Performance 황제낙엽 2010.08.18 45
105 javascirpt IME-Mode 설정하기 황제낙엽 2010.08.17 1112
104 Iframe 내의 페이지 접근방법 황제낙엽 2009.11.12 59
103 외부 라이브러리 (.js) 의 바람직한 동적 로딩 (The best way to load external JavaScript) 황제낙엽 2009.10.05 124
102 숫자값으로의 변환 형태 황제낙엽 2009.09.02 18
101 Boolean 데이터 타입 황제낙엽 2009.09.02 16
100 toString 변환 테이블 황제낙엽 2009.09.02 13
99 URI 인코딩을 해야 하는 문자들 황제낙엽 2009.09.02 23
» 체인 생성자(생성자 체인), 프로토타입 체인 그리고 생성자 재지정 황제낙엽 2009.08.12 55