Account

Option Explicit
Private mvarAccountEntryCollection As Collection
Private mvarObserverCollection As Collection
Private mvaraccountName As String

Public Property Let accountName(ByVal vData As String)
    mvaraccountName = vData
End Property

Public Property Get accountName() As String
    accountName = mvaraccountName
End Property

Public Function getEntries() As Collection
    Set getEntries = mvarAccountEntryCollection
End Function

Public Sub addEntry(entryDate As Date, amount As Currency)
    Dim entry As New accountEntry
    entry.amount = amount
    entry.entryDate = entryDate
    Call mvarAccountEntryCollection.Add(entry)
End Sub

Public Sub notify()
    Dim observer As AccountObserver
    For Each observer In mvarObserverCollection
        Call observer.update(Me)
    Next
End Sub

Public Sub detachObserver(observer As AccountObserver, key As
       String)
    Call mvarObserverCollection.Remove(key)
End Sub

Public Sub attachObserver(observer As AccountObserver, key As
       String)
    Call mvarObserverCollection.Add(observer, key)
End Sub


Private Sub Class_Initialize()
    Set mvarAccountEntryCollection = New Collection
    Set mvarObserverCollection = New Collection
End Sub

Private Sub Class_Terminate()
    Set mvarAccountEntryCollection = Nothing
    Set mvarObserverCollection = Nothing
End Sub

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.17.122