public void CallDelegates(DelegateExample d) { Console.WriteLine("Using Instance Method"); Console.WriteLine("Enter Principle, Rate of Interest & Number of Years Respectively :"); double principle = Convert.ToDouble(Console.ReadLine()); double ROI = Convert.ToDouble(Console.ReadLine()); double years = Convert.ToDouble(Console.ReadLine()); //Instance Method CalculateSimpleInterest d0 = new CalculateSimpleInterest(d.GetTotalInterest); d0 += new CalculateSimpleInterest(d.GetInterestRatePerYear); d0(principle, ROI, years); }
static void Main(string[] args) { /* * EventsExample1 e = new EventsExample1(); * Listener l = new Listener(); * l.Subscribe(e); * e.Start(); */ /* * EmployeeData e = new EmployeeData(); * e.DisplayEmployeeData(); */ DelegateExample d = new DelegateExample(); d.CallDelegates(d); Console.ReadKey(); }