Code Metaphor

Programming, Writing, Reading, Thoughts…

클로져를 이용한 데이터 은닉

function Person(name) {
    this.setName(name);
}

Person.prototype.setName = function(name) {
    this.getName = function() {
        return name;
    }
}

“과연 데이터 은닉이 필요한가”, “get/set 메서드가 JavaScript에 어울리는 스타일인가” 등의 논제는 다루지 않겠음.

This entry was posted on May 9, 2007 at 10:49 PM. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Responses to “클로져를 이용한 데이터 은닉”

  1. Heungsub Says:

    이제 보니까 굉장히 매력있는 방법이군요! 아예 데이터가 속성으로는 남지 않네요.

  2. Hong, MinHee (DAHLIA) Says:

    갑자기 왜 뒷북…

Powered by WordPress. Styled by Hong, MinHee. XML Feed, Comments XML Feed.