If row >= 0 Then
Dim v As Vehicle
v = Vehicle(VehicleList.RowTag(row))
v.AddMileage(Val(MileageField.Text))
LoadListBox
End If[/code]
This code is from the VehicleOOPExample and I’m trying to unpack it in my mind.
I don’t understand how to read the line v = Vehicle(VehicleList.RowTag(row))
According to this v is a class of type Vehicle and so we can assign a Vehicle to it.
And I do understand that in the VehicleList.RowTag we have previously stored a specific instance of the class vehicle.
What I don’t understand is the use of the parenthesis with the class name Vehicle
Here’s the line with the parenthesis I’m unclear about in bold v = Vehicleb[/b]
In my mind () implies an array or a method. I don’t quite understand what it means when used with a class.
I searched the docs, watched the video a few times and couldn’t find anything about using parenthesis with a class.
(I only wrote this disclaimer because in the karmic language of reality someone is sure to point me to the obvious place in the docs that explains all this )
I take your point. Once I was pointed toward casting I went through the forum and there is an enormous amount of discussion. There was a point made that variants are seen as somewhat prone to misuse and the advice is to on the whole not use them. Then of course we find the listbox uses them.
I think that this is an issue of coding techniques where the habit is to always enforce the type, just in case.
It did over complicate the example but it forced me to learn something new. I’m barely at the “I know a little XOJO” level. That’s why I find these forums helpful as people expose how they practice the language. I have, of course, noticed that you are extremely generous, along with many others, in taking the time to “correct our pronunciation” of the language.