Object Oriented Javascript : Constructor and member method


function Shape()
{
}
function Shape_GetArea()
{
return this.area;
}
function Shape_GetParameter()
{
return this.parameter;
}
function Shape_Draw()
{
alert( "Drawing generic shape" );
}
function Circle( r )
{
this.area = Math.PI * r * r;
this.parameter = 2 * Math.PI * r;
}
function Circle_Draw()
{
alert( "Drawing circle" );
}
function Rectangle( x, y )
{
this.area = x * y;
this.parameter = 2 * x + 2 * y;
}
function Rectangle_Draw()
{
alert( "Drawing rectangle" );
}
Shape.prototype.GetArea = Shape_GetArea;
Shape.prototype.GetParameter = Shape_GetParameter;
Shape.prototype.Draw = Shape_Draw;
/*var ashape = new Shape();
alert(ashape.GetArea());*/
Circle.prototype = new Shape();
Circle.prototype.constructor = Circle;
Circle.prototype.baseClass = Shape.prototype.constructor;
Circle.prototype.Draw = Circle_Draw;

var acircle = new Circle();