mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 12:32:41 +00:00
22 lines
322 B
Lox
22 lines
322 B
Lox
|
|
class Base {
|
||
|
|
method() {
|
||
|
|
print "Base.method()";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class Derived < Base {
|
||
|
|
method() {
|
||
|
|
super.method();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class OtherBase {
|
||
|
|
method() {
|
||
|
|
print "OtherBase.method()";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var derived = Derived();
|
||
|
|
derived.method(); // expect: Base.method()
|
||
|
|
Base = OtherBase;
|
||
|
|
derived.method(); // expect: Base.method()
|