Table of contents Home page
Execute this code
function Point(x, y) { this.x = x this.y = y } Point.prototype.toString = function() {return "(" + this.x + "," + this.y + ")"} function Circle(centre, radius) { this.centre = centre this.radius = radius } Circle.prototype.area = function() {return Math.PI * this.radius * this.radius} c = new Circle(new Point(6, 3), 4) alert("The area of the circle is " + c.area() + " and the centre point is " + c.centre + ".")