I like to be able to write something like this:
dim d as new Date
dim s as String = d // <- this is what I want to achieve, i.e. automatic conversion
Usually, with my own custom classes, I could add an Operator_Convert function to it, like this:
function Operator_Convert() as String
return "x"
end function
With built-in classes, this doesn’t work (it’s not feasible to make subclasses of them as I get them passed from other functions I do not control).
So I thought I could use the “extends” parameter attribute like this:
function Operator_Convert(extends d as Date) as String
return d.SQLDateTime
end function
But that doesn’t work - I get a TypeMismatchException at dim s as String = d
.
Is there a way?