Property Getter/Setters

qsrtech

Active Member
Licensed User
Longtime User
Hi Erel, any timeline on when property getters and setters will be implemented?

Thanks!
John
 

qsrtech

Active Member
Licensed User
Longtime User
Hi Erel, I appreciate it is probably a lot of work to implement this feature but it's kind of pretty crucial to being an OOP language. Look forward to seeing your update including this.

Thanks!
John
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Properties
Starting from B4A v2.70, classes support properties. Properties syntax can be considered a syntactic sugar.
Properties combine two methods into a single "field" like member.
For example the two following methods:
Code:

B4X:
'Gets or sets the text
Sub getText As String
   Return btn.Text
End Sub

Sub setText(t As String)
   btn.Text = t
End Sub


Are merged automatically into a single property:

SS-2013-05-12_11.42.31.png

The property can be treated like any other field:


look here for class tutorial.
 
Top