假设您有以下三个类:
Public Class SpecialJob : Inherits Job
Public Property Details As List(Of Detail)
Public Property JobTotals As Totals
End Class
Public Class SpecialDetail : Inherits Detail
Public Property DetailTotals As Totals
Public Property DocNum As String
Public Property Reference As String
End Class
Public Class Totals
Public Property Expense As Decimal
Get
Return tExpense
End Get
Set(value As Decimal)
TotalExpense -= tExpense
tExpense = value
TotalExpense += tExpense
End Set
End Property
Public Property Tax As Decimal
Get
Return tTax
End Get
Set(value As Decimal)
TotalExpense -= tTax
tTax = value
TotalExpense += tTax
End Set
End Property
Public Property TotalExpense As Decimal
End Class
如何实现解决方案,以便更新Detail类的费用也会更新Job类的费用?
编辑: 每个类中还有许多其他属性和功能。我只用了几个来展示基本结构。