the following code won’t compile (error no constructor)
<pre class=”lang:monkey decode:true ” title=”no constructor is called…”>
#Import “<std>”
#Import “<mojo>”
Using std..
Using mojo..
Class MyWindow Extends Window
Method OnRender( canvas:Canvas ) Override
canvas.DrawText(“hellow”,110,30)
End Method
End Class
Function Main()
New AppInstance
New MyWindow(“HELLOW”,1000,600,WindowFlags.Resizable)
App.Run()
End Function
So we have to call the constructor by ourselves adding the New method
<pre class=”lang:monkey decode:true “>
#Import “<std>”
#Import “<mojo>”
Using std..
Using mojo..
Class MyWindow Extends Window
Method New(title:String,w:Int,h:Int,flag:WindowFlags)
Super.New(title,w,h,flag)
End Method
Method OnRender( canvas:Canvas ) Override
canvas.DrawText(“hellow”,110,30)
End Method
End Class
Function Main()
New AppInstance
New MyWindow(“HELLOW”,1000,600,WindowFlags.Resizable)
App.Run()
End Function
why the super constructor is not called automatically if no method is declared? it complicates things (not usefully?).
Is the constructor the only thing that is not inherited automatically?
PS: sorry I don’t get how to embed code with the crayon thing…