How to set Read only object properties with class

Penko

Active Member
Licensed User
Longtime User
Private prop as string

Sub PropProperty()
Return prop
End Sub

I have missed the initialize part where you obviously will set this string a value from a parameter.

Note that you can't use a property name equal to the variable name. What I do is to append the keyword 'property' at the end in order to be able to use the auto complete feature of the IDE. Otherwise, if you put it in front, all your properties begin the same way and it is definitely slower to choose the right one when the IDE pops up the suggestions.

Sent from my HTC Desire using Tapatalk 2
 
Upvote 0

Jost aus Soest

Active Member
Licensed User
Longtime User
It's not supported in B4A (in the moiment).

As a workaround you can use 0-ary methods like this:
B4X:
Sub Lastname As String
  Return "Smith"
End Sub
 
Upvote 0
Top