mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +01:00
18 lines
387 B
Plaintext
18 lines
387 B
Plaintext
class Foo {
|
|
new { IO.write("zero") }
|
|
new(a) { IO.write(a) }
|
|
new(a, b) { IO.write(a + b) }
|
|
|
|
toString { return "Foo" }
|
|
}
|
|
|
|
// Can overload by arity.
|
|
new Foo // expect: zero
|
|
new Foo("one") // expect: one
|
|
new Foo("one", "two") // expect: onetwo
|
|
|
|
// Returns the new instance.
|
|
var foo = new Foo // expect: zero
|
|
IO.write(foo is Foo) // expect: true
|
|
IO.write(foo.toString) // expect: Foo
|