hello, I am currently doing an university assignment and have completed it but unsure of a little part. Its a homework for practicing to write classes with a header file and two cpp files instead of all in one.

but for this assignment,my teacher said that although we can access data members that are private with member functions of said class, set and get functions are used to access them instead.

the question now:
In the first function i will take a argument from the function and then add that to the value of the data member account balance (AccBal) but since i cant access the data member directly i cant do this:

AccBal = Amt + AccBal;

so i have been trying to find a way and ended up doing this:

Account::getAccBal();
Amt = Amt + AccBal;
Account::setAccBal(Amt);

I am not changing the value of the private data member directly so that is fine, right?

I am sorry that it is so confusing, i can post the whole code so you can understand it better.

Thanks in advance