Use "construct" instead of "this" to define constructors.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
this new(arg) {
|
||||
construct new(arg) {
|
||||
IO.print("new A ", arg)
|
||||
_field = arg
|
||||
}
|
||||
@@ -8,7 +8,7 @@ class A {
|
||||
}
|
||||
|
||||
class B is A {
|
||||
this new(arg1, arg2) {
|
||||
construct new(arg1, arg2) {
|
||||
super(arg2)
|
||||
IO.print("new B ", arg1)
|
||||
_field = arg1
|
||||
@@ -18,7 +18,7 @@ class B is A {
|
||||
}
|
||||
|
||||
class C is B {
|
||||
this new() {
|
||||
construct new() {
|
||||
super("one", "two")
|
||||
IO.print("new C")
|
||||
_field = "c"
|
||||
|
||||
Reference in New Issue
Block a user