/// <summary> /// The Event Listener has Dependency on the Banking object /// The event listener will generate the Notiofication /// Based on the Status of the event /// </summary> /// <param name="bank"></param> public EventListener(Banking bank) { this.bank = bank; // event subscription this.bank.OverBalance += Bank_OverBalance; this.bank.UnderBalance += Bank_UnderBalance; }
public static void Main() { Banking bank = new Banking(20000); EventListener evt = new EventListener(bank); bank.Deposit(90000); Console.WriteLine($"Banlance after Deposit is {bank.ShowBalance()}"); bank.Withdrawal(108000); Console.WriteLine($"Banlance after Withdrawal is {bank.ShowBalance()}"); Console.WriteLine("Hello World"); Console.ReadLine(); }