public void Transfer(BankAccount1 a, double amount) //Transfer { Console.WriteLine($"Your balance before transfer is {balance:C}."); balance = balance - amount; a.balance = a.balance - amount; Console.WriteLine($"{amount:C} transferred to {a.GetName()}. Your current balance is {this.GetBalance():C}"); }
static void Main() { BankAccount1 myAcc = new BankAccount1("Di Wei", 91195026, 546.36); BankAccount1 another = new BankAccount1("Emilia", 1234566, 0); myAcc.PrintInfo(); myAcc.Withdraw(50); myAcc.Deposit(4368.45); myAcc.Transfer(another, 1000); another.PrintInfo(); }