딘 에드워즈가 만든 Base 라이브러리로 클래스를 생성하고 상속하는 간단한 예


딘 에드워즈의 웹사이트 : http://dean.edwards.name/

A Base Class for Javascript Inheritance : http://dean.edwards.name/weblog/2006/03/base/

ie7-js : http://code.google.com/p/ie7-js/

base2 (A standards-bases javascript Library) : http://code.google.com/p/base2/

cssQuery() : http://dean.edwards.name/my/cssQuery/

        //새 Person 클래스를 만든다.
        var Person = Base.extend({
            // Person 클래스 생성자
            constructor: function( name ) {
                this.name = name;
            },
        
            //Person 클래스의 간단한 메서드
            getName: function() {
                return this.name;
            }
        });
        
        // Person 클래스를 상속하는  새 User 클래스를 만든다.
        var User = Person.extend({
            // User 클래스의 생성자를 만든다.
            constructor: function( name, password ) {
                // 부모 클래스의 생성자 메서드를 호출한다.
                this.base( name );
                this.password = password;
            },
        
            // User 클래스에 간단한 메서드를 추가한다.
            getPassword: function() {
                return this.password;
            }
        });

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 홍반장

2011/03/31 15:54 2011/03/31 15:54
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/6022

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/6022

« Previous : 1 : ... 450 : 451 : 452 : 453 : 454 : 455 : 456 : 457 : 458 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/04   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Statistics Graph

Site Stats

Total hits:
182125
Today:
121
Yesterday:
506