All academies
All challenges

Fix encapsulation on BankAccount

Encapsulation

solution.ts
easy+50 XP

Make `balance` private. Expose `deposit(amount)`, `withdraw(amount)`, and `getBalance()`. Reject non-positive deposits and overdrafts by throwing Error.

Judge

Press Run tests to execute your solution in the sandbox judge.