Imports System
Class Employee
Private MName As String
Private MDob As DateTime
Private MEmailAlias As String
Public Sub New(ByVal Name As String, ByVal Dob As DateTime)
MName = Name
MDob = Dob
End Sub
Public Property Name() As String
Get
Return MName
End Get
Set(ByVal Value As String)
MName = Value
End Set
End Property
Public ReadOnly Property Brithday() As DateTime
Get
Return MDob
End Get
End Property
Public WriteOnly Property EmailAlias() As String
Set(ByVal Value As String)
MEmailAlias = Value
End Set
End Property
Public ReadOnly Property EmailAddress() As String
Get
Return MEmailAlias & "@a.com"
End Get
End Property
End Class
Module ReadableAndWritable
Sub Main()
Dim emp As New Employee("T", New DateTime(1997, 7, 2))
emp.Name = "T"
Console.WriteLine("Name: {0}", emp.Name)
Console.WriteLine("Date of birth: {0}", emp.Brithday.ToLongDateString)
emp.EmailAlias = "AAA"
Console.WriteLine("Email address: {0}", emp.EmailAddress)
End Sub
End Module
Name: T
Date of birth: July 2, 1997
Email address: AAA@a.com