2013-11-13 19:05:03 +00:00
|
|
|
class Foo {
|
2015-09-15 14:46:09 +00:00
|
|
|
methodOnFoo { System.print("foo") }
|
|
|
|
|
method(a) { System.print("foo") }
|
|
|
|
|
method(a, b, c) { System.print("foo") }
|
|
|
|
|
override { System.print("foo") }
|
2013-11-13 19:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Bar is Foo {
|
2015-09-01 15:16:04 +00:00
|
|
|
construct new() {}
|
2015-09-15 14:46:09 +00:00
|
|
|
methodOnBar { System.print("bar") }
|
|
|
|
|
method(a, b) { System.print("bar") }
|
|
|
|
|
method(a, b, c, d) { System.print("bar") }
|
|
|
|
|
override { System.print("bar") }
|
2013-11-13 19:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
2015-07-10 16:18:22 +00:00
|
|
|
var bar = Bar.new()
|
2013-11-13 19:05:03 +00:00
|
|
|
bar.methodOnFoo // expect: foo
|
|
|
|
|
bar.methodOnBar // expect: bar
|
|
|
|
|
|
|
|
|
|
// Methods with different arity do not shadow each other.
|
|
|
|
|
bar.method(1) // expect: foo
|
|
|
|
|
bar.method(1, 2) // expect: bar
|
|
|
|
|
bar.method(1, 2, 3) // expect: foo
|
|
|
|
|
bar.method(1, 2, 3, 4) // expect: bar
|
2013-12-17 17:39:05 +00:00
|
|
|
bar.override // expect: bar
|