BankAccount Class Reference

A simple bank account created as an everyday example for the OOP course. Used in particular for demonstrating inheritance. More...

Inherited by CheckAccount, LotteryAccount, and SavingsAccount.

List of all members.

Public Member Functions

 BankAccount (string o, decimal b, double ir)
 Construct a bank account from owner, balance, and interestRate.
 BankAccount (string o, double ir)
 Construct a bank account from owner and interestRate.
virtual void Withdraw (decimal amount)
 
  • Withdraw an amount of money from the account.
  • This decreases the balance of the account.

virtual void Deposit (decimal amount)
 Withdraw an amount of money from the account. This increases the balance of the account.
virtual void AddInterests ()
 Add the annual interest to the account. This may increase the current balance of the account.
override string ToString ()
 Return a text string that represents this account for output purposes.

Protected Attributes

double interestRate
string owner
decimal balance

Properties

virtual decimal Balance [get]
 Returns the current amount of the bank account with affecting the account.

Detailed Description

A simple bank account created as an everyday example for the OOP course. Used in particular for demonstrating inheritance.

         BankAccount ba = new BankAccount("Peter");
         ba.Deposit(100.0);
         ba.Withdraw(50.0);

Definition at line 20 of file bank-account.cs.


Constructor & Destructor Documentation

BankAccount.BankAccount ( string  o,
decimal  b,
double  ir 
)

Construct a bank account from owner, balance, and interestRate.

Parameters:
o The owners name
b The initial amount of this account
ir The interest rate. Annual interet is calculated as balance * interestRate

Definition at line 35 of file bank-account.cs.

References balance, interestRate, and owner.

BankAccount.BankAccount ( string  o,
double  ir 
)

Construct a bank account from owner and interestRate.

Parameters:
o The owners name
ir The interest rate. Annual interet is calculated as balance * interestRate

Definition at line 49 of file bank-account.cs.


Member Function Documentation

virtual void BankAccount.AddInterests (  )  [virtual]

Add the annual interest to the account. This may increase the current balance of the account.

Reimplemented in LotteryAccount, and SavingsAccount.

Definition at line 92 of file bank-account.cs.

References balance, and interestRate.

virtual void BankAccount.Deposit ( decimal  amount  )  [virtual]

Withdraw an amount of money from the account. This increases the balance of the account.

Parameters:
amount The amount of money to deposit to the account. Precondition: Must be non-negative.

Definition at line 84 of file bank-account.cs.

References balance.

override string BankAccount.ToString (  ) 

Return a text string that represents this account for output purposes.

Reimplemented in CheckAccount, LotteryAccount, and SavingsAccount.

Definition at line 100 of file bank-account.cs.

References balance, and owner.

virtual void BankAccount.Withdraw ( decimal  amount  )  [virtual]

  • Withdraw an amount of money from the account.
  • This decreases the balance of the account.

Parameters:
amount The amount of money to withdraw from the account. Precondition: Must be non-negative.

Reimplemented in CheckAccount, and SavingsAccount.

Definition at line 72 of file bank-account.cs.

References balance.


Member Data Documentation

decimal BankAccount.balance [protected]
double BankAccount.interestRate [protected]
string BankAccount.owner [protected]

Property Documentation

virtual decimal BankAccount.Balance [get]

Returns the current amount of the bank account with affecting the account.

The amount of money

Definition at line 58 of file bank-account.cs.


The documentation for this class was generated from the following file:

Generated on Thu Nov 5 13:38:15 2009 for BankAccounts with inheritance by  doxygen 1.6.1