static void Main() { IBankAccount venusAccount = new SaverAccount(); ITransferBankAccount jupiterAccount = new CurrentAccount(); venusAccount.PayIn(200); jupiterAccount.PayIn(500); jupiterAccount.TransferTo(venusAccount, 100); Console.WriteLine(venusAccount.ToString()); Console.WriteLine(jupiterAccount.ToString()); }
static void Main() { IBankAccount venusAccount = new SaverAccount(); //When F9 is pressed, IBankAccount is called from interface Wrox.ProCSharp.IBankAccount ITransferBankAccount jupiterAccount = new CurrentAccount(); //Each Method is called from an Interface venusAccount.PayIn(200); //venusAccount is a local variable, When F5(debug) is pressed, value of venusAccount is set to null jupiterAccount.PayIn(500); jupiterAccount.TransferTo(venusAccount, 100); Console.WriteLine(venusAccount.ToString());//When F5 is pressed on this line, value changes from null to 0 Console.WriteLine(jupiterAccount.ToString());//When F5 is pressed on this line, value changes from null to 0 }