My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

Description

A simple JavaScript implementation of object-oriented inheritance.

Download

http://jsii.googlecode.com/files/jsii-1.0.0.js

Usage Example

var Shape = Class.extend({
    init: function(height, width) {
        this.height = height;
        this.width = width;
    },
    info: function() {
        alert("I have height = " + this.height +
            " and width = " + this.width);
    }
});

var Rectangle = Shape.extend({
});

var Square = Rectangle.extend({
    init: function(size) {
        this.inherited().init(size, size);
    }
});

var rectangle = new Rectangle(5, 10);
var square = new Square(10);

rectangle.info(); // it will alert => I have height = 5 and width = 10
square.info(); // it will alert => I have height = 10 and width = 10
Powered by Google Project Hosting