class class1
sub operator_convert(m as memoryblock)
end sub
end class
event window1.open
dim m as memoryblock
dim c as class1 = m // compile error here : There is more than one method with this name but this does not match any of the available signatures.
end sub
Instantiating the memoryblock does not fix the error - it is a compile error whereby the compiler fails to find the operator_convert function.
It appears to be something specifically wrong with memoryblock, because if I replace all memoryblock references by, for example, picture, the code compiles correctly.
Public Sub Operator_Convert(rhs As Object)
If rhs IsA MemoryBlock Then
m = MemoryBlock(rhs)
Else
Raise New InvalidArgumentException("Must use a memoryblock to convert to")
End If
End Sub
[code]// This will work
Var m As New MemoryBlock(1024)
Var c As Class1 = m
// This won’t work, throws an invalidArgumentException
Var x As New Dictionary
Var b As Class1 = x
[/code]
@Kem Tekinay I posted to feedback as a beta bug, because for unknown reason, Feedback prevented me from specifying Case Type = Bug. The link is : <https://xojo.com/issue/60281>