class Rectangle : public Shape {
protected:
int width;
int length;
public:
Rectangle(const int pwidth, const int plength, const int px, const int py);
Rectangle& operator+=(Rectangle& rhs){
this->width += rhs.width;
this->length+= rhs.length;
this->getX() += rhs.getX();
this->getY() += rhs.getY();
return *this;
}
};
I am trying to overload the += operator in my rectangle class(subclass) and I am running into an issue when I try to bring the x and y values from my shape class(superclass) my idle is telling me the expression must be a modifiable lvalue what am I doing wrong? I have getters and setters in my shape class which do the obvious and they are both ints.
The errors occur on these lines
this->getX() += rhs.getX();
this->getY() += rhs.getY();