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 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
You know the right answer?
#include using namespace std;
class InchSize {
public:
InchSize(int wholeInches =...
Questions
question
Mathematics, 22.04.2021 18:10
question
Mathematics, 22.04.2021 18:10
question
Mathematics, 22.04.2021 18:10
question
Mathematics, 22.04.2021 18:10
question
Mathematics, 22.04.2021 18:10
question
History, 22.04.2021 18:10
question
Mathematics, 22.04.2021 18:10
Questions on the website: 13722363