So, the title says it all, but as an example, imagine the my class implements methods that depend on particular hardware, or OS version...
I Test this conditions on the Initialize method, and I return a Boolean, and that works... but, If I test isInitialized, it returns True...
So.... Is it possible to return isInitialized as False or to "Un-Initialize" my class?
Sub Process_Globals
Dim k As myClass
End Sub
Sub AppStart (Args() As String)
k.Initialize(4,"init")
Log(k.isInitialized) ' returns true
k.Initialize(5,"fred")
Log(k.isinitialized) ' returns false
End Sub
myClass
B4X:
Sub Class_Globals
Dim isInitialized As Boolean
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( a As Int, b As String)
If b <> "init" Then
isInitialized = False
Else
isInitialized = True
End If
End Sub
Sub Process_Globals
Dim k As myClass
End Sub
Sub AppStart (Args() As String)
k.Initialize(4,"init")
Log(k.isInitialized) ' returns true
k.Initialize(5,"fred")
Log(k.isinitialized) ' returns false
End Sub
myClass
B4X:
Sub Class_Globals
Dim isInitialized As Boolean
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( a As Int, b As String)
If b <> "init" Then
isInitialized = False
Else
isInitialized = True
End If
End Sub
Sub Process_Globals
Dim k As myClass
End Sub
Sub AppStart (Args() As String)
k.Initialize(4,"init")
Log(k.isInitialized) ' returns true
k.Initialize(5,"fred")
Log(k.isinitialized) ' returns false
End Sub
myClass
B4X:
Sub Class_Globals
Dim isInitialized As Boolean
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( a As Int, b As String)
If b <> "init" Then
isInitialized = False
Else
isInitialized = True
End If
End Sub