javascript instance/class properties/method

Instance Properties
Instance Method
Class Properties
Class Methods

function Rec(x, y) {
    //Instance Properties
    //모든 instance of Rec가 각각의 속성을 가진다
    this.x = x;
    this.y = y;
}
//Instance Method
//each instance does not have its own copy of Instance Method
Rec.prototype.area = function() { return this.x * this.y; }

* instance property와 instance method는 object의 instance에서만 접근할 수 있다.
ex) rec1.x; rec1.area();

* reading and writing of properties
    e.g.)property area, object rec1
    1. object에 있는 property를 찾는다.
    2. 없을 경우, constructor's prototype object에 있는지 찾아본다.
    3. 없을 경우, Object에 정의되어있는지 찾아본다.


http://blogs.msdn.com/jscript/archive/2007/09/30/classes-in-jscript-part-ii-instance-properties-methods-class-properties-methods.aspx
http://devedge-temp.mozilla.org/viewsource/2001/oop-javascript/
http://9eye.net/entry/Scope-In-Javascript-2

카테고리

분류 전체보기 (690)N
About me. (6)
Daylogs (655)N
비공개 (0)
영어공부 (0)
My works - 추억 (29)