← Encapsulation, const Correctness & static Members

Private Balance with Getter

easy

balance is private – main has no way to read it directly. Add a const member function getBalance that returns it, giving main a controlled, read-only way to ask an account what it holds.

Mark it const: it only reads balance, never changes it, so it should be usable even on an account you only have const (read-only) access to.

Your solution

"Run" uses the sample stdin ("100"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution