Ejemplo n.º 1
0
 public static void Main(string[] args)
 {
     BankAccount ba;
     SavingsAccount sa;
     // Create a bank account, withdraw $100, and
     // display the results.
     ba = new BankAccount(200M);
     ba.Withdraw(100M);
     // Try the same trick with a savings account.
     sa = new SavingsAccount(200M, 12);
     sa.Withdraw(100M);
     // Display the resulting balance.
     Console.WriteLine("When invoked directly:");
     Console.WriteLine("BankAccount balance is {0:C}", ba.Balance);
     Console.WriteLine("SavingsAccount balance is {0:C}", sa.Balance);
     // Wait for user to acknowledge the results.
     Console.WriteLine("Press Enter to terminate...");
     Console.Read();
 }
Ejemplo n.º 2
0
 public static void MakeAWithdrawal(BankAccount ba, decimal amount)
 {
     ba.Withdraw(amount);
 }