subject

#include using namespace std;
class InchSize {
public:
InchSize(int wholeInches = 0, int sixteenths = 0);
void Print() const;
InchSize operator+(InchSize rhs);
private:
int inches;
int sixteenths;
};
InchSize InchSize::operator+(InchSize rhs) {
InchSize totalSize; //this line
totalSize. inches = inches + rhs. inches; //this line
totalSize. sixteenths = sixteenths + rhs. sixteenths; //this line
// If sixteenths is greater than an inch, carry 1 to inches.
if (totalSize. sixteenths >= 16) {
totalSize. inches += 1;
totalSize. sixteenths -= 16;
}
return totalSize;
}

can anyone explain how these lines work? I am confused on how "InchSize totalSize;" is used.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
What can tanya do now to start preparing for the college and scholarship application process? think about her grades, activities in which she can get involved, possible part-time jobs at which she can work, and standardized tests she can take. (10 points) apex
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
You are most likely to automatically encode information about
Answers: 1
You know the right answer?
#include using namespace std;
class InchSize {
public:
InchSize(int wholeInches =...
Questions
question
Biology, 10.04.2021 01:00
question
Mathematics, 10.04.2021 01:00
question
Mathematics, 10.04.2021 01:00
question
Mathematics, 10.04.2021 01:00