Files
wren/test/language/super/call_different_arity.wren
T
Bob Nystrom 5fb6186d7d Make constructors just methods.
* Eliminate "new" reserved word.
* Allow "this" before a method definition to define a constructor.
* Only create a default constructor for classes that don't define one.
2015-07-10 09:18:22 -07:00

21 lines
355 B
Plaintext

class Base {
foo { IO.print("Base.foo") }
foo(a) { IO.print("Base.foo(a)") }
foo(a, b) { IO.print("Base.foo(a, b)") }
}
class Derived is Base {
foo(a) {
IO.print("Derived.bar(a)")
super
super(1)
super(1, 2)
}
}
Derived.new().foo(1)
// expect: Derived.bar(a)
// expect: Base.foo
// expect: Base.foo(a)
// expect: Base.foo(a, b)