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 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 22.06.2019 14:30
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
question
Computers and Technology, 23.06.2019 01:50
Free points just awnser this. what should i watch on netflix
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
Which option correctly describes a dbms application? a. software used to manage databases b. software used to organize files and folders c. software used to develop specialized images d. software used to create effective presentations
Answers: 1
You know the right answer?
#include using namespace std;
class InchSize {
public:
InchSize(int wholeInches =...
Questions
question
Mathematics, 10.03.2021 06:20
question
Mathematics, 10.03.2021 06:20
question
Mathematics, 10.03.2021 06:20
question
Mathematics, 10.03.2021 06:20
question
Advanced Placement (AP), 10.03.2021 06:20
question
Mathematics, 10.03.2021 06:20
Questions on the website: 13722360