[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A call to new no longer takes the super objects parameters
[Thread Prev] | [Thread Next]
- Subject: A call to new no longer takes the super objects parameters
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Wed, 5 Jun 2024 09:10:09 -0700
- To: GambasList <user@xxxxxxxxxxxxxxxxxxxxxx>
In the past if _new(p1 as integer, p2 as integer) was defined for a class 1 and and class 2 inherits class I and defines _new() then I can do xx = new class2(1,3) no problem it respects the inherited class parameters. I could also do the following .. where me is a class 2 object xx = object.class(me).new(1,2)But recently this fails with a too many parameters error, I seems to no longer call the super._new or respect the parameters.
There seems to no longer be any way to dynamically create an instance of an inherited class.
If I try to define class 2 with the parameters, then it just tacks them to the end of the class one parameters as it should
something seems to have broken. Here is a sample script ---------------------------------------------------------------------------------------------------- #!/usr/bin/env gbs3 ' Gambas Script File Created 06/05/2024 08:54:06 Class Adds Property Read sum As Integer iA As Integer iB As Integer Public Sub _new(a As Integer, b As Integer) iA = a iB = b End Private Function sum_read() As Integer Return iA + iB End End Class Class Mults Inherits Adds Property Read Mult As Integer iC As Integer Public Sub _new(c As Integer) iC = c End Private Function mult_read() As Integer Return Super.sum * ic End End Class Dim s1 As New Adds(1, 2) Dim m1 As New Mults(1, 2, 3) Print s1.sum, m1.mult Print object.class(m1).name Dim m2 As Variant = object.class(m1).new(1, 3, 4) Print m2.mult Quit 0 Catch Error "Script Error >";; error.text & "\n" & error.where ------------------------------------------------------------------------------------------------------------------------ -- ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: A call to new no longer takes the super objects parameters | Brian G <brian@xxxxxxxxxxxxxxxx> |