Can I use set/get properties in "Code Module" as in "Class Module"?
B4X:
'Code Module : MyModule
Sub setMyProperty(Value As Object)
m_MyProperty=Value
End Sub
Sub getMyProperty As Object
Return m_MyProperty
End Sub
. . .
'Activity module
MyModule.MyProperty = "value"
Log(MyModule.MyProperty)
. . .
Thanks for the reply. Of course I know the differences. What I am asking is a syntactic ease as Erel phrased "Properties syntax can be considered a syntactic sugar."
Can I use set/get properties in "Code Module" as in "Class Module"?
B4X:
'Code Module : MyModule
Sub setMyProperty(Value As Object)
m_MyProperty=Value
End Sub
Sub getMyProperty As Object
Return m_MyProperty
End Sub
. . .
'Activity module
MyModule.MyProperty = "value"
Log(MyModule.MyProperty)
. . .
I just tested it. You can create the public methods as Informatix said, e.g. getText / setText, but you wont have the associated Text property which is the syntatic sugar. Since properties are only for classes.