User-defined Types

JS++ supports user-defined types via the class keyword. All user-defined types are - by default - internal types.

Example

1
2
3
4
5
6
7
8
9
10
class Point
{
    int x;
    int y;
 
    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

The Point class above can now be used as follows:

1
Point origin = new Point(0, 0);

See Also

Share

HTML | BBCode | Direct Link