function Box(x, y, w, h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}
function ImageBox(x, y, w, h) {
Box.call(this, x, y, w, h); // Apply Box function logic to new ImageBox object
this.src = ....
this.title = ...
}
// Make all ImageBox object inherit from an instance of Box
ImageBox.prototype = Object.create(Box.prototype);
function TextBox(x, y, w, h) {
Box.call(this, x, y, w, h); // Apply Box function logic to new TextBox object
this.font = ...
this.font-size =...
this.color =....
}
// Make all TextBox object inherit from an instance of Box
TextBox.prototype = Object.create(Box.prototype);