mlox/lox.t/super/reassign_superclass.lox

22 lines
322 B
Lox
Raw Normal View History

2024-08-03 02:44:12 +02:00
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()