摘要:(200-06-21) VB.NET 類別規劃 Overriding 覆寫
Overriding
覆寫父親的Method
子類別不想直接繼承使用(重寫或部份衍生)
子類別
'想改寫父親有的 method calSalary()
Public Overrides Function calSalary() As Decimal
Dim b As Decimal = MyBase.calSalary() '原來底薪
Me._salary = b + Me._bon
End Function
父類別
'薪資計算的功能Method
'定結構 非關細部操作
'Overridable 允許子類別可以進行複寫
Public Overridable Overloads Function calSalary() As Decimal
Return Me._salary
End Function