Spright
Active Member
I am adding datatype point (i know vector2d exist, this is actually an excericse in OO in B4a).
so i would normally think about it like this
So i added a class module, adn filled it in, I noticed there was a place for vars, so i moved them there.Of course it's still wrong, but I'm lacking examples hw to do ir correctly?
so i would normally think about it like this
B4X:
Class Point
Dim mX As Float
Dim mY As Float
Sub New(x As Float,y As Float)
mX = x
mY = y
End Sub
End Class
So i added a class module, adn filled it in, I noticed there was a place for vars, so i moved them there.Of course it's still wrong, but I'm lacking examples hw to do ir correctly?
B4X:
Sub Class_Globals
Private mX As Float
Private mY As Float
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
Class Point
Sub New(x As Float,y As Float)
mX = x
mY = y
End Sub
End Class