Not sure where to start, so I'm just going to plow in. Let's say I'm trying to represent an economy in OOP. A basic design I've come up with is:
class Person{
int $money; // Money someone has in wallet/purse
int $bank_account_id;
function getAmountOfMoney()
function addMoney($amountToAdd)
function subtractMoney($amountToSubtract)
}
class BankAccount{
int $money; // Money in Bank Account
int $interest_per_year;
function giveInterest()
function depositMoney() // Calls $person->subtractMoney()
function withdrawMoney() // Calls $person->addMoney()
}
Are there any design flaws here?