racket/collects/honu/examples/subclass-ext.honu
2005-05-27 18:56:37 +00:00

31 lines
387 B
Plaintext

type t1 {
int x;
int y;
}
type t2 <: t1 {
int add();
}
class c1() : t1 implements t1 {
init int x;
init int y;
export t1 : x, y;
}
subclass c2() : t2 extends c1 at t1 implements t2 with int x, int y {
init int x;
init int y;
super(x = x, y = y);
int add() { return x + y; }
export t2: x, y, add;
}
int main() {
new c2:t2(x = 4, y = 6).add();
}