コード例 #1
0
        public bool TransferMoney(IBankAccount otherAccount, decimal amount)
        {
            var fee = CalculateFee(amount, WithDrawType.Transfer);

            if (UpdateBalance(amount + fee))
            {
                otherAccount.DepositMoney(amount);
            }


            return(true);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jadroman/codePatterns
        static void Main(string[] args)
        {
            BankAccountFactory localBankAccFact   = new LocalBankAccountFactory();
            BankAccountFactory foreignBankAccFact = new ForeignBankAccountFactory();

            IBankAccount localBankAcc = localBankAccFact.CreateBankAccount();

            localBankAcc.DepositMoney(40);

            IBankAccount foreignBankAcc = foreignBankAccFact.CreateBankAccount();

            foreignBankAcc.DepositMoney(40);

            Console.ReadKey();
        }
コード例 #3
0
ファイル: IBankAccount.cs プロジェクト: Neptuned/Week-5-Day-3
 public bool TransferMoney(IBankAccount otherAccount, decimal amount)
 {
     this.WithDrawMoney(amount);
     otherAccount.DepositMoney(amount);
     return true;
 }
コード例 #4
0
ファイル: IBankAccount.cs プロジェクト: Neptuned/Week-5-Day-3
        public bool TransferMoney(IBankAccount otherAccount, decimal amount)
        {
            var fee = CalculateFee(amount, WithDrawType.Transfer);
            if (UpdateBalance(amount + fee))
            {
                otherAccount.DepositMoney(amount);
            }

            return true;
        }
コード例 #5
0
 public bool TransferMoney(IBankAccount otherAccount, decimal amount)
 {
     this.WithDrawMoney(amount);
     otherAccount.DepositMoney(amount);
     return(true);
 }