class Client{ name; doc; }
class AccountCurrent{ agency; _balance = 0; // private
withdrawMoney(value){
if (this._balance >= value) {
this._balance -= value;
}
}
deposity(value){
if (value <= 0) return;
this._balance += value;
}
transfer(value, account){
const valueWithdraw = this.withdrawMoney(value);
account.deposity(valueWithdraw);
}
}
const clientOne = new Client(); clientOne.name = "Jessica"; clientOne.doc = 44455566677;
const clientTwo = new Client(); clientTwo.name = "Adriano"; clientTwo.doc = 33344455500;
const clientOneAccount = new AccountCurrent(); clientOneAccount.agency = 8888; clientOneAccount.client = clientOne; clientOneAccount.deposity(500);
const clientTwoAccount = new AccountCurrent(); clientTwoAccount.agency = 6666; clientTwoAccount.client = clientTwo;
clientOneAccount.transfer(200, clientTwoAccount); console.log(clientTwoAccount);