Fix the deposit Member Function

Easy

The BankAccount class has a bug: deposit overwrites the balance instead of adding to it, so the program prints 25 and 125 instead of the running totals. Fix deposit so each call adds the amount to m_balance. Once the output is correct, read the assembly panel and find the hidden this argument: at each call site the account's address is loaded into rdi before the call, and inside deposit the member is accessed at offset 0 from this.

Success Criteria

Your code must pass 1 test case(s) to complete this exercise. 3 hint(s) are available if you need help.

Sign in to track your progress

You can work on exercises as a guest, but sign in to track your progress and save your submissions.

This platform is built by its community

Every lesson, project, and tool on HelloC++ is funded by sponsors. Join them and help shape what we build next.

Become a Patron