so I've been having trouble with operator overloading. So I have a program that has an object called Weight that has 2 attributes, pounds and ounces. I figured out all the other operators, but the increment one has been giving me trouble. I tried to do it this way, but for some reason, it doesn't want to work.
Here are the declarations in the header file (including the 2 variables):
void operator++();
void operator--();
private:
int pounds;
int ounces;
And the member functions:
void Weight::operator++() {
pounds + 1;
ounces + 15;
}
void Weight::operator--() {
pounds - 1;
ounces - 15;
}
Anything helps!