Closed GWRon closed 1 year ago
Constructors work differently and can't be overridden like regular methods. Override
isn't allowed on them, although the (error message you're getting is misleading).
Base types are initialized with New()
by default. If you want to delegate to a different constructor, you can do that with an explicit call at the top, as in
Type TExt Extends TBase
Method New(i:Int, j:Int)
Super.New i, j
Print "TExt.new("+i+", "+j+")"
End Method
End Type
I had this "super.new()" in mind too. And I am okay with not being able to "override".
Yet i would have thought that TExt.new(10, 20)
Would call a TBase.new(i, j) If it existed, but it only automatically calls the new() version without params.
I am trying to override an overloaded "New()". Prior I was using
which I now thought could be replaced with overloaded "New"-chains ... while normal "new()" works, it seems to not work with overloaded "new(params)".
results in:
this one:
Compiles but only outputs:
and finally:
outputs: