I am having a structure that is actually a simple byte with more functionality.
I defined it this way:
Structure DeltaTime
Private m_DeltaTime As Byte
Public ReadOnly DeltaTime As Byte
Get
Return m_DeltaTime
End Get
End Property
End Structure
I want to have these two functionalities:
Public Sub Main
Dim x As DeltaTime = 80 'Create a new instance of DeltaTime set to 80
Dim y As New ClassWithDtProperty With { .DeltaTime = 80 }
End Sub
Is there a way to achieve this?
If there would be a way to inherit from Structure I would simply inherit from Byte adding my functionality, basically I just need a byte Structure with custom functionality.
My question is also valid when you want to define your new singleton member value-types (like, you want to define a nibble-type for instance etc.) and you want to be able to set it with an assignment to number or other language typed representation.
In other words, I want to be able to do define the following Int4 (nibble) stucture and use it as follows:
Dim myNibble As Int4 = &HF 'Unsigned