The whole section of code you quoted is the definition of a class.
The lines you asked about are declarations of functions that are members of the class.
Code:
SavingsAccount &calculateMonthlyInterest();
The & means the function returns a reference to a SavingsAccount object, rather than returning a SavingsAccount object by value.
Code:
void printBalance() const;
First you should understand that a function that is a non static member of a class takes a pointer to an object of that class as an implied extra parameter. So printBalance() appears to take zero parameters, but it really takes one parameter.
If you declared just
Code:
void printBalance();
then the implied extra parameter is
SavingsAccount* this;
The const you asked about in
Code:
void printBalance() const;
causes that implied extra parameter to be declared as
SavingsAccount const* this;
Quote:
Originally Posted by action_owl
This is not homework
|
I don't care, because it looks like reasonable question for you to ask here even if it were part of a homework assignment. If some detail within an assignment confuses you, ask about it. That is not the same as asking people to do the assignment for you.