Change the Date for all objects of a class
Hello, I'm hoping I can get an idea for how to impliment this.
I have two subclasses (SavingsAccount & CheckingAccount) that derive from a BankAccount class. What I need to do is call a function that changes the date of all objects created by either two subclasses. For example:
Code:
BankAccount.changeDate(1,1,2000);
savingsAccountA.print();
savingsAccountB.print();
checkingAccountA.print();
checkingAccountB.print();
BankAccount.changeDate(2,14,2001);
savingsAccountA.print();
savingsAccountB.print();
checkingAccountA.print();
checkingAccountB.print();
Output:
Quote:
Savings Account A: Jan 1, 2000
Savings Account B: Jan 1, 2000
Checking Account A: Jan 1, 2000
Checking Account B: Jan 1, 2000
Savings Account A: Feb, 14, 2001
Savings Account B: Feb, 14, 2001
Checking Account A: Feb, 14, 2001
Checking Account B: Feb, 14, 2001
I'm sure there is a simple way to do this, but for the life of me I can't figure it out. The ultimate goal is to make a date mutatable so that when a new month is set, interest will be added to each account as well as some other monthly occurances.