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(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); }
private void button1_Click(object sender, EventArgs e) { IBankAccount venusAccount = new SaverAccount(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); }
static void Main(string[] args) { IBankAccount venusAccount = new SaverAccount(); ITransferBankAccount jupiterAccount = new CurrentAccount(); venusAccount.PayIn(200); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.PayIn(400); jupiterAccount.Withdraw(500); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); bool isTrans = jupiterAccount.TransferTo(venusAccount, 300); if (isTrans) { Console.WriteLine("转账后:" + jupiterAccount.ToString()); Console.WriteLine("转账后: " + venusAccount.ToString()); } else { Console.WriteLine("转账失败"); } Console.Read(); }