コード例 #1
0
        static void Main(string[] args)
        {
            BankAccount    ba;
            SavingsAccount sa;

            ba = new BankAccount(200M);
            ba.Withdraw(100M);

            sa = new SavingsAccount(222M, 12);
            sa.Withdraw(100M);

            Console.WriteLine("When invode directly:");
            Console.WriteLine("BankAccount balance is {0}", ba.Balance);
            Console.WriteLine("SavingsAccount balance is {0}", sa.Balance);

            Console.WriteLine("");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: sempf/CSharp2012
 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();
 }
コード例 #3
0
        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();
        }
コード例 #4
0
 public static void MakeAWithdrawal(BankAccount ba,
                                    decimal mAmount)
 {
     ba.Withdraw(mAmount);
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: sempf/CSharp2012
 public static void MakeAWithdrawal(BankAccount ba, decimal amount)
 {
     ba.Withdraw(amount);
 }