Compound values are similar to objects in that they have fields and methods, but different in that they are passed by value and can be allocated on the stack. They also cannot be inherited/overwritten as a class/object can.
Example:
public value rangeI { public int from; public int to; public constructor(int from, int to) { this.from = from; this.to = to; } final public bool operator==(rangeI a) { return from == a.from and to == a.to; } final public int span() { return to - from; } }
Comments
0 comments
Please sign in to leave a comment.