Hi,
Consider you want to create a javascript class for Rect.
function Rect(top,left,width,height){
this.top = top;
this.left = left;
this.width = width;
this.height = height;
}
Rect.prototype.getTop = function(){
return this.top;
}
Rect.prototype.getLeft = function(){
return this.left;
}
Rect.prototype.getBottom = function(){
return (this.top + this.height);
}
Rect.prototype.getRight = function(){
return (this.left + this.width);
}
Rect.prototype.getWidth = function(){
return this.width;
}
Rect.prototype.getHeight = function(){
return this.height;
}
Now, If I want to use this class, I can do that as following:
var rc = new Rect(0,0,100,100);
var rcTop = rc.getTop();
var rcLeft = rc.getLeft();
....
....
....
Hope, this will satisfy your need.
Thanks