I kind of oversimplified my example.
Right now after working with types, I've realized to vb.net they are "Structures" that can only hold values or types
They cannot however do this:
Code:
Private _UserSecurity As Credential
Public Property UserSecurity As Credential
Get
Return _UserSecurity
End Get
Set(value As Credential)
_UserSecurity = value
'Do something else here in code, like update a database.
End Set
End Property
On otherwords, we can't make Functions or Methods from scratch attached to the Type itself like the built in classes.
Example:
Code:
MyType.GetAllOrdersStartingWith("0123")
Or
MyType.Orders = ListOfOrders
and have it save it to SQLite in one shot, as well as setting that property simultaniously.
In the B4A world they are "libraries", the missing part is creating new libraries purely in B4A, using only things available in B4A.
It's a little strange to me still, seeing as how a class is pretty much an "Activity" if it was a type instead.
Maybe that's the solution.
In an Activity we can create, methods, functions, variables, public properties, but we can't declare it as a standalone object wherever we want.
A code module would be perfect if we could say Dim x as new MyCodeModule, treating it like a class in a library.
Our end code could look like so:
Code:
Dim p as new person 'This auto initializes all properties
p.Name = "Tom" 'We set a value
p.Save() 'We call .save wich stores it locally to SQLite for example, or anything else
dim s as Person = p.GetSupervison() 'Can possibly return a newly loaded person from SQlite
p.Punish() 'Could figure out who it's child people are, and set .Punished = True for himself and others in one shot.