I found the following example in Dojo: The Definitive Guide:
function Shape(centerX, centerY, color)
{
this.centerX = centerX;
this.centerY = centerY;
this.color = color;
};
function Circle(centerX, centerY, color, radius)
{
this.base = Shape;
this.base(centerX, centerY, color);
this.radius = radius;
};
c = new Circle(10, 20, "blue", 2);
Please explain how this example works. I understand that when we call the constructor Circle, then this
refers to the object being created, so it is clear for me why c
object has base
and radius
properties, but how does it get centerX
, centerY
, color
?