mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
26 lines
254 B
Lox
26 lines
254 B
Lox
|
|
class A {
|
||
|
|
say() {
|
||
|
|
print "A";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class B < A {
|
||
|
|
getClosure() {
|
||
|
|
fun closure() {
|
||
|
|
super.say();
|
||
|
|
}
|
||
|
|
return closure;
|
||
|
|
}
|
||
|
|
|
||
|
|
say() {
|
||
|
|
print "B";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class C < B {
|
||
|
|
say() {
|
||
|
|
print "C";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
C().getClosure()(); // expect: A
|