摘要:(200-06-21) VB.NET 類別規劃 物件初始化(Intializer)
建構子初始化
Imports mod06.Domain.IT
Module TestSalesObjectIntializer
Public Sub Main()
'定義區域變數 透過屬性初始化物件
Dim sales As New Sales() With {.Id = "0001", .Name = "eric", .BirthDate = New DateTime(2000, 1, 1), .Sex = "男性", .Qa = 50000}
sales.Salary = 20000
'建構建構子
Dim sales2 As New Sales("0002", "linda", New DateTime(2000, 12, 31), "女性", 60000)
Dim sales3 As New Sales()
sales3.Id = "0003"
'多載呼叫獎金計算
sales.calBon(60000)
sales.calSalary() '呼叫Employee規劃 少掉獎金部分???
'問薪資
System.Console.WriteLine(sales.Salary)
End Sub
End Module