Other Another "funny" feature similar to "public private variables"

LucaMs

Expert
Licensed User
"Similar"? 🤔

I made a mistake (this is very unusual 😁), writing "stuff" in a wrong class.

Here I write different classes than the real project but they are fine to show the anomaly (or is it a feature?).
Two classes: clsPerson, clsGroup (which should have an Array of clsPerson objects).
One (empty) code module: modUtils.

My mistake was not to notice that I was writing source code in the clsPerson class while I would have had to do it in the clsGroup, that is to declare in the clsPerson the array of Person objects and the initialization of this Array with clsPerson objects.

Note: clsPerson - the wrong class I was writing in.
clsPerson:
Sub Class_Globals
    Private marrPersons(6) As clsPerson
End Sub

Public Sub Initialize
    InitPersonsArray
End Sub

Private Sub InitPersonsArray
    For i = 0 To 5
        Dim Person As clsPerson
        Person.Initialize
        marrPersons(i) = Person
    Next
End Sub

Well, in this class besides seeing the private variables, a topic we have already written about... among the members of an instance of this class (again only inside the class) I see... the modUtils code module! [and the Main Form - I was developing in B4J].

1629933708668.png


[I thought I would have attached the sample project but now it seems superfluous to me, the image is enough]


P.S.
I just noticed now that the modUtils member is shown as a modUtils type, as if it were a class.
I thought that, although it would be strange, it could be due to the fact that code modules in B4J are very similar to class modules but it is not so, the same thing happens in B4A.
 
Last edited:
Top